diff --git a/CHANGELOG.md b/CHANGELOG.md index b5a5c770..9ddc0ef9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,7 @@ _This release is scheduled to be released on 2021-04-01._ - Portuguese translations for "MODULE_CONFIG_CHANGED" and PRECIP. - Respect parameter ColoredSymbolOnly also for custom events - Added a new parameter to hide time portion on relative times +- `module.show` has now the option for a callback on error. - Added locale to sample config file - Added support for self-signed certificates for the default calendar module (#466) diff --git a/js/main.js b/js/main.js index 95d546cd..6f5d9484 100644 --- a/js/main.js +++ b/js/main.js @@ -295,6 +295,9 @@ var MM = (function () { // Otherwise cancel show action. if (module.lockStrings.length !== 0 && options.force !== true) { Log.log("Will not show " + module.name + ". LockStrings active: " + module.lockStrings.join(",")); + if (typeof options.onError === "function") { + options.onError(new Error("LOCK_STRING_ACTIVE")); + } return; } diff --git a/js/module.js b/js/module.js index f5cbf86f..042b674b 100644 --- a/js/module.js +++ b/js/module.js @@ -428,12 +428,11 @@ var Module = Class.extend({ callback = callback || function () {}; options = options || {}; - var self = this; MM.showModule( this, speed, - function () { - self.resume(); + () => { + this.resume(); callback(); }, options