From a2263e57292b7b6822c37c951b40b355a277fecd Mon Sep 17 00:00:00 2001 From: toasted-nutbread Date: Sun, 8 Dec 2019 22:23:23 -0500 Subject: Update display message handlers --- ext/mixed/js/display.js | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'ext/mixed') 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)] +]); -- cgit v1.2.3