summaryrefslogtreecommitdiff
path: root/ext/js/comm/frame-offset-forwarder.js
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2024-02-01 10:00:59 -0500
committerGitHub <noreply@github.com>2024-02-01 15:00:59 +0000
commitdfd42bad0b46845ad88d1fdc5fa82b4f03bab0f3 (patch)
tree04686b943b84b33b8927238be17e4bc0dda7eb62 /ext/js/comm/frame-offset-forwarder.js
parent2356223942a21d1683ac38eed8e7b9485f453d87 (diff)
Application refactor (#591)
* Rename Yomitan class to Application, change initialization style * Rename file * Update init * Update config * Remove dead code
Diffstat (limited to 'ext/js/comm/frame-offset-forwarder.js')
-rw-r--r--ext/js/comm/frame-offset-forwarder.js12
1 files changed, 7 insertions, 5 deletions
diff --git a/ext/js/comm/frame-offset-forwarder.js b/ext/js/comm/frame-offset-forwarder.js
index a1f249e2..fe1ff98a 100644
--- a/ext/js/comm/frame-offset-forwarder.js
+++ b/ext/js/comm/frame-offset-forwarder.js
@@ -16,18 +16,20 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
-import {yomitan} from '../yomitan.js';
import {FrameAncestryHandler} from './frame-ancestry-handler.js';
export class FrameOffsetForwarder {
/**
+ * @param {import('../comm/cross-frame-api.js').CrossFrameAPI} crossFrameApi
* @param {number} frameId
*/
- constructor(frameId) {
+ constructor(crossFrameApi, frameId) {
+ /** @type {import('../comm/cross-frame-api.js').CrossFrameAPI} */
+ this._crossFrameApi = crossFrameApi;
/** @type {number} */
this._frameId = frameId;
/** @type {FrameAncestryHandler} */
- this._frameAncestryHandler = new FrameAncestryHandler(frameId);
+ this._frameAncestryHandler = new FrameAncestryHandler(crossFrameApi, frameId);
}
/**
@@ -35,7 +37,7 @@ export class FrameOffsetForwarder {
*/
prepare() {
this._frameAncestryHandler.prepare();
- yomitan.crossFrame.registerHandlers([
+ this._crossFrameApi.registerHandlers([
['frameOffsetForwarderGetChildFrameRect', this._onMessageGetChildFrameRect.bind(this)]
]);
}
@@ -55,7 +57,7 @@ export class FrameOffsetForwarder {
/** @type {Promise<?import('frame-offset-forwarder').ChildFrameRect>[]} */
const promises = [];
for (const frameId of ancestorFrameIds) {
- promises.push(yomitan.crossFrame.invoke(frameId, 'frameOffsetForwarderGetChildFrameRect', {frameId: childFrameId}));
+ promises.push(this._crossFrameApi.invoke(frameId, 'frameOffsetForwarderGetChildFrameRect', {frameId: childFrameId}));
childFrameId = frameId;
}