mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-06-29 12:39:45 +00:00
move error callback into options and rename it
This commit is contained in:
parent
1ed721fb15
commit
9d85baee37
12
js/main.js
12
js/main.js
@ -279,9 +279,8 @@ var MM = (function () {
|
|||||||
* @param {number} speed The speed of the show animation.
|
* @param {number} speed The speed of the show animation.
|
||||||
* @param {Function} callback Called when the animation is done.
|
* @param {Function} callback Called when the animation is done.
|
||||||
* @param {object} [options] Optional settings for the show method.
|
* @param {object} [options] Optional settings for the show method.
|
||||||
* @param {Function} errorCallback Called when the module failed to show.
|
|
||||||
*/
|
*/
|
||||||
var showModule = function (module, speed, callback, errorCallback, options) {
|
var showModule = function (module, speed, callback, options) {
|
||||||
options = options || {};
|
options = options || {};
|
||||||
|
|
||||||
// remove lockString if set in options.
|
// remove lockString if set in options.
|
||||||
@ -296,8 +295,8 @@ var MM = (function () {
|
|||||||
// Otherwise cancel show action.
|
// Otherwise cancel show action.
|
||||||
if (module.lockStrings.length !== 0 && options.force !== true) {
|
if (module.lockStrings.length !== 0 && options.force !== true) {
|
||||||
Log.log("Will not show " + module.name + ". LockStrings active: " + module.lockStrings.join(","));
|
Log.log("Will not show " + module.name + ". LockStrings active: " + module.lockStrings.join(","));
|
||||||
if (typeof errorCallback === "function") {
|
if (typeof options.onError === "function") {
|
||||||
errorCallback(new Error("ERR_ACTIVE_LOCK_STRINGS"));
|
options.onError(new Error("ERR_ACTIVE_LOCK_STRINGS"));
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -590,11 +589,10 @@ var MM = (function () {
|
|||||||
* @param {number} speed The speed of the show animation.
|
* @param {number} speed The speed of the show animation.
|
||||||
* @param {Function} callback Called when the animation is done.
|
* @param {Function} callback Called when the animation is done.
|
||||||
* @param {object} [options] Optional settings for the show method.
|
* @param {object} [options] Optional settings for the show method.
|
||||||
* @param {Function} errorCallback Called when the module failed to show.
|
|
||||||
*/
|
*/
|
||||||
showModule: function (module, speed, callback, errorCallback, options) {
|
showModule: function (module, speed, callback, options) {
|
||||||
// do not change module.hidden yet, only if we really show it later
|
// do not change module.hidden yet, only if we really show it later
|
||||||
showModule(module, speed, callback, errorCallback, options);
|
showModule(module, speed, callback, options);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
})();
|
})();
|
||||||
|
@ -416,9 +416,8 @@ var Module = Class.extend({
|
|||||||
* @param {number} speed The speed of the show animation.
|
* @param {number} speed The speed of the show animation.
|
||||||
* @param {Function} callback Called when the animation is done.
|
* @param {Function} callback Called when the animation is done.
|
||||||
* @param {object} [options] Optional settings for the show method.
|
* @param {object} [options] Optional settings for the show method.
|
||||||
* @param {Function} errorCallback Called when the module failed to show.
|
|
||||||
*/
|
*/
|
||||||
show: function (speed, callback, options, errorCallback) {
|
show: function (speed, callback, options) {
|
||||||
if (typeof callback === "object") {
|
if (typeof callback === "object") {
|
||||||
options = callback;
|
options = callback;
|
||||||
callback = function () {};
|
callback = function () {};
|
||||||
@ -426,7 +425,6 @@ var Module = Class.extend({
|
|||||||
|
|
||||||
callback = callback || function () {};
|
callback = callback || function () {};
|
||||||
options = options || {};
|
options = options || {};
|
||||||
errorCallback = errorCallback || function () {};
|
|
||||||
|
|
||||||
MM.showModule(
|
MM.showModule(
|
||||||
this,
|
this,
|
||||||
@ -435,7 +433,6 @@ var Module = Class.extend({
|
|||||||
this.resume();
|
this.resume();
|
||||||
callback();
|
callback();
|
||||||
},
|
},
|
||||||
errorCallback,
|
|
||||||
options
|
options
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user