summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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)]
+]);