Move event handler definitions

This commit is contained in:
toasted-nutbread 2020-02-26 19:48:53 -05:00
parent 359eabb26e
commit d17af2cbab

View File

@ -54,6 +54,10 @@ class DisplaySearch extends Display {
['AltGraph', []],
['Shift', []]
]);
this._runtimeMessageHandlers = new Map([
['searchQueryUpdate', ({query}) => { this.onExternalSearchUpdate(query); }]
]);
}
static create() {
@ -156,10 +160,10 @@ class DisplaySearch extends Display {
}
onRuntimeMessage({action, params}, sender, callback) {
const handler = DisplaySearch._runtimeMessageHandlers.get(action);
const handler = this._runtimeMessageHandlers.get(action);
if (typeof handler !== 'function') { return false; }
const result = handler(this, params, sender);
const result = handler(params, sender);
callback(result);
return false;
}
@ -360,8 +364,4 @@ class DisplaySearch extends Display {
}
}
DisplaySearch._runtimeMessageHandlers = new Map([
['searchQueryUpdate', (self, {query}) => { self.onExternalSearchUpdate(query); }]
]);
DisplaySearch.instance = DisplaySearch.create();