Move event handler definitions
This commit is contained in:
parent
359eabb26e
commit
d17af2cbab
@ -54,6 +54,10 @@ class DisplaySearch extends Display {
|
|||||||
['AltGraph', []],
|
['AltGraph', []],
|
||||||
['Shift', []]
|
['Shift', []]
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
this._runtimeMessageHandlers = new Map([
|
||||||
|
['searchQueryUpdate', ({query}) => { this.onExternalSearchUpdate(query); }]
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
static create() {
|
static create() {
|
||||||
@ -156,10 +160,10 @@ class DisplaySearch extends Display {
|
|||||||
}
|
}
|
||||||
|
|
||||||
onRuntimeMessage({action, params}, sender, callback) {
|
onRuntimeMessage({action, params}, sender, callback) {
|
||||||
const handler = DisplaySearch._runtimeMessageHandlers.get(action);
|
const handler = this._runtimeMessageHandlers.get(action);
|
||||||
if (typeof handler !== 'function') { return false; }
|
if (typeof handler !== 'function') { return false; }
|
||||||
|
|
||||||
const result = handler(this, params, sender);
|
const result = handler(params, sender);
|
||||||
callback(result);
|
callback(result);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -360,8 +364,4 @@ class DisplaySearch extends Display {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DisplaySearch._runtimeMessageHandlers = new Map([
|
|
||||||
['searchQueryUpdate', (self, {query}) => { self.onExternalSearchUpdate(query); }]
|
|
||||||
]);
|
|
||||||
|
|
||||||
DisplaySearch.instance = DisplaySearch.create();
|
DisplaySearch.instance = DisplaySearch.create();
|
||||||
|
Loading…
Reference in New Issue
Block a user