From 3c226215419ca815712e9568f7d871a96f5ff1cf Mon Sep 17 00:00:00 2001 From: toasted-nutbread Date: Wed, 20 Dec 2023 00:18:55 -0500 Subject: Simplify message handlers (#396) --- ext/js/app/frontend.js | 18 +++++++++--------- ext/js/app/popup-factory.js | 30 +++++++++++++++--------------- 2 files changed, 24 insertions(+), 24 deletions(-) (limited to 'ext/js/app') diff --git a/ext/js/app/frontend.js b/ext/js/app/frontend.js index a1bbb217..8c11775a 100644 --- a/ext/js/app/frontend.js +++ b/ext/js/app/frontend.js @@ -108,10 +108,10 @@ export class Frontend { /* eslint-disable no-multi-spaces */ /** @type {import('core').MessageHandlerMap} */ - this._runtimeMessageHandlers = new Map(/** @type {import('core').MessageHandlerArray} */ ([ - ['Frontend.requestReadyBroadcast', {async: false, handler: this._onMessageRequestFrontendReadyBroadcast.bind(this)}], - ['Frontend.setAllVisibleOverride', {async: true, handler: this._onApiSetAllVisibleOverride.bind(this)}], - ['Frontend.clearAllVisibleOverride', {async: true, handler: this._onApiClearAllVisibleOverride.bind(this)}] + this._runtimeMessageHandlers = new Map(/** @type {import('core').MessageHandlerMapInit} */ ([ + ['Frontend.requestReadyBroadcast', this._onMessageRequestFrontendReadyBroadcast.bind(this)], + ['Frontend.setAllVisibleOverride', this._onApiSetAllVisibleOverride.bind(this)], + ['Frontend.clearAllVisibleOverride', this._onApiClearAllVisibleOverride.bind(this)] ])); this._hotkeyHandler.registerActions([ @@ -178,11 +178,11 @@ export class Frontend { /* eslint-disable no-multi-spaces */ yomitan.crossFrame.registerHandlers([ - ['Frontend.closePopup', {async: false, handler: this._onApiClosePopup.bind(this)}], - ['Frontend.copySelection', {async: false, handler: this._onApiCopySelection.bind(this)}], - ['Frontend.getSelectionText', {async: false, handler: this._onApiGetSelectionText.bind(this)}], - ['Frontend.getPopupInfo', {async: false, handler: this._onApiGetPopupInfo.bind(this)}], - ['Frontend.getPageInfo', {async: false, handler: this._onApiGetPageInfo.bind(this)}] + ['Frontend.closePopup', this._onApiClosePopup.bind(this)], + ['Frontend.copySelection', this._onApiCopySelection.bind(this)], + ['Frontend.getSelectionText', this._onApiGetSelectionText.bind(this)], + ['Frontend.getPopupInfo', this._onApiGetPopupInfo.bind(this)], + ['Frontend.getPageInfo', this._onApiGetPageInfo.bind(this)] ]); /* eslint-enable no-multi-spaces */ diff --git a/ext/js/app/popup-factory.js b/ext/js/app/popup-factory.js index 41984841..184a55ca 100644 --- a/ext/js/app/popup-factory.js +++ b/ext/js/app/popup-factory.js @@ -49,21 +49,21 @@ export class PopupFactory { this._frameOffsetForwarder.prepare(); /* eslint-disable no-multi-spaces */ yomitan.crossFrame.registerHandlers([ - ['PopupFactory.getOrCreatePopup', {async: true, handler: this._onApiGetOrCreatePopup.bind(this)}], - ['PopupFactory.setOptionsContext', {async: true, handler: this._onApiSetOptionsContext.bind(this)}], - ['PopupFactory.hide', {async: true, handler: this._onApiHide.bind(this)}], - ['PopupFactory.isVisible', {async: true, handler: this._onApiIsVisibleAsync.bind(this)}], - ['PopupFactory.setVisibleOverride', {async: true, handler: this._onApiSetVisibleOverride.bind(this)}], - ['PopupFactory.clearVisibleOverride', {async: true, handler: this._onApiClearVisibleOverride.bind(this)}], - ['PopupFactory.containsPoint', {async: true, handler: this._onApiContainsPoint.bind(this)}], - ['PopupFactory.showContent', {async: true, handler: this._onApiShowContent.bind(this)}], - ['PopupFactory.setCustomCss', {async: true, handler: this._onApiSetCustomCss.bind(this)}], - ['PopupFactory.clearAutoPlayTimer', {async: true, handler: this._onApiClearAutoPlayTimer.bind(this)}], - ['PopupFactory.setContentScale', {async: true, handler: this._onApiSetContentScale.bind(this)}], - ['PopupFactory.updateTheme', {async: true, handler: this._onApiUpdateTheme.bind(this)}], - ['PopupFactory.setCustomOuterCss', {async: true, handler: this._onApiSetCustomOuterCss.bind(this)}], - ['PopupFactory.getFrameSize', {async: true, handler: this._onApiGetFrameSize.bind(this)}], - ['PopupFactory.setFrameSize', {async: true, handler: this._onApiSetFrameSize.bind(this)}] + ['PopupFactory.getOrCreatePopup', this._onApiGetOrCreatePopup.bind(this)], + ['PopupFactory.setOptionsContext', this._onApiSetOptionsContext.bind(this)], + ['PopupFactory.hide', this._onApiHide.bind(this)], + ['PopupFactory.isVisible', this._onApiIsVisibleAsync.bind(this)], + ['PopupFactory.setVisibleOverride', this._onApiSetVisibleOverride.bind(this)], + ['PopupFactory.clearVisibleOverride', this._onApiClearVisibleOverride.bind(this)], + ['PopupFactory.containsPoint', this._onApiContainsPoint.bind(this)], + ['PopupFactory.showContent', this._onApiShowContent.bind(this)], + ['PopupFactory.setCustomCss', this._onApiSetCustomCss.bind(this)], + ['PopupFactory.clearAutoPlayTimer', this._onApiClearAutoPlayTimer.bind(this)], + ['PopupFactory.setContentScale', this._onApiSetContentScale.bind(this)], + ['PopupFactory.updateTheme', this._onApiUpdateTheme.bind(this)], + ['PopupFactory.setCustomOuterCss', this._onApiSetCustomOuterCss.bind(this)], + ['PopupFactory.getFrameSize', this._onApiGetFrameSize.bind(this)], + ['PopupFactory.setFrameSize', this._onApiSetFrameSize.bind(this)] ]); /* eslint-enable no-multi-spaces */ } -- cgit v1.2.3