aboutsummaryrefslogtreecommitdiff
path: root/ext/mixed/js/display.js
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2019-12-08 22:23:23 -0500
committertoasted-nutbread <toasted-nutbread@users.noreply.github.com>2019-12-13 23:11:56 -0500
commita2263e57292b7b6822c37c951b40b355a277fecd (patch)
tree3280129e166dbe90e9e503b7c8137da0e6e21fc5 /ext/mixed/js/display.js
parent863e36e829e4e01a8c1e7b15384820ad7766d6a8 (diff)
Update display message handlers
Diffstat (limited to 'ext/mixed/js/display.js')
-rw-r--r--ext/mixed/js/display.js18
1 files changed, 9 insertions, 9 deletions
diff --git a/ext/mixed/js/display.js b/ext/mixed/js/display.js
index 6e2c8e6a..9d3dc51b 100644
--- a/ext/mixed/js/display.js
+++ b/ext/mixed/js/display.js
@@ -227,12 +227,12 @@ class Display {
}
onRuntimeMessage({action, params}, sender, callback) {
- const handlers = Display.runtimeMessageHandlers;
- if (hasOwn(handlers, action)) {
- const handler = handlers[action];
- const result = handler(this, params);
- callback(result);
- }
+ const handler = Display._runtimeMessageHandlers.get(action);
+ if (typeof handler !== 'function') { return false; }
+
+ const result = handler(this, params, sender);
+ callback(result);
+ return false;
}
getOptionsContext() {
@@ -880,6 +880,6 @@ Display.onKeyDownHandlers = {
}
};
-Display.runtimeMessageHandlers = {
- optionsUpdate: (self) => self.updateOptions(null)
-};
+Display._runtimeMessageHandlers = new Map([
+ ['optionsUpdate', (self) => self.updateOptions(null)]
+]);