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/comm/cross-frame-api.js | 2 +- ext/js/comm/frame-ancestry-handler.js | 4 +++- ext/js/comm/frame-offset-forwarder.js | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) (limited to 'ext/js/comm') diff --git a/ext/js/comm/cross-frame-api.js b/ext/js/comm/cross-frame-api.js index 0d3f3275..023ca18e 100644 --- a/ext/js/comm/cross-frame-api.js +++ b/ext/js/comm/cross-frame-api.js @@ -351,7 +351,7 @@ export class CrossFrameAPI { } /** - * @param {import('core').MessageHandlerArray} messageHandlers + * @param {import('core').MessageHandlerMapInit} messageHandlers * @throws {Error} */ registerHandlers(messageHandlers) { diff --git a/ext/js/comm/frame-ancestry-handler.js b/ext/js/comm/frame-ancestry-handler.js index b91046bc..261ea943 100644 --- a/ext/js/comm/frame-ancestry-handler.js +++ b/ext/js/comm/frame-ancestry-handler.js @@ -164,7 +164,9 @@ export class FrameAncestryHandler { }; // Start - yomitan.crossFrame.registerHandlers([[responseMessageId, {async: false, handler: onMessage}]]); + yomitan.crossFrame.registerHandlers([ + [responseMessageId, onMessage] + ]); resetTimeout(); const frameId = this._frameId; this._requestFrameInfo(targetWindow, frameId, frameId, uniqueId, nonce); diff --git a/ext/js/comm/frame-offset-forwarder.js b/ext/js/comm/frame-offset-forwarder.js index af9bd268..afa6a5e6 100644 --- a/ext/js/comm/frame-offset-forwarder.js +++ b/ext/js/comm/frame-offset-forwarder.js @@ -36,7 +36,7 @@ export class FrameOffsetForwarder { prepare() { this._frameAncestryHandler.prepare(); yomitan.crossFrame.registerHandlers([ - ['FrameOffsetForwarder.getChildFrameRect', {async: false, handler: this._onMessageGetChildFrameRect.bind(this)}] + ['FrameOffsetForwarder.getChildFrameRect', this._onMessageGetChildFrameRect.bind(this)] ]); } -- cgit v1.2.3