aboutsummaryrefslogtreecommitdiff
path: root/ext/fg
diff options
context:
space:
mode:
Diffstat (limited to 'ext/fg')
-rw-r--r--ext/fg/js/frontend.js20
1 files changed, 1 insertions, 19 deletions
diff --git a/ext/fg/js/frontend.js b/ext/fg/js/frontend.js
index 1618fa12..aa03d4b5 100644
--- a/ext/fg/js/frontend.js
+++ b/ext/fg/js/frontend.js
@@ -211,25 +211,7 @@ class Frontend {
_onRuntimeMessage({action, params}, sender, callback) {
const messageHandler = this._runtimeMessageHandlers.get(action);
if (typeof messageHandler === 'undefined') { return false; }
-
- const {handler, async} = messageHandler;
-
- try {
- const promiseOrResult = handler(params, sender);
- if (async) {
- promiseOrResult.then(
- (result) => callback({result}),
- (error) => callback({error: errorToJson(error)})
- );
- return true;
- } else {
- callback({result: promiseOrResult});
- return false;
- }
- } catch (error) {
- callback({error: errorToJson(error)});
- return false;
- }
+ return yomichan.invokeMessageHandler(messageHandler, params, callback, sender);
}
_onZoomChanged({newZoomFactor}) {