summaryrefslogtreecommitdiff
path: root/ext/js/comm/frame-endpoint.js
diff options
context:
space:
mode:
Diffstat (limited to 'ext/js/comm/frame-endpoint.js')
-rw-r--r--ext/js/comm/frame-endpoint.js12
1 files changed, 8 insertions, 4 deletions
diff --git a/ext/js/comm/frame-endpoint.js b/ext/js/comm/frame-endpoint.js
index 0008417d..d2002d2e 100644
--- a/ext/js/comm/frame-endpoint.js
+++ b/ext/js/comm/frame-endpoint.js
@@ -18,10 +18,14 @@
import {EventListenerCollection} from '../core/event-listener-collection.js';
import {generateId} from '../core/utilities.js';
-import {yomitan} from '../yomitan.js';
export class FrameEndpoint {
- constructor() {
+ /**
+ * @param {import('../comm/api.js').API} api
+ */
+ constructor(api) {
+ /** @type {import('../comm/api.js').API} */
+ this._api = api;
/** @type {string} */
this._secret = generateId(16);
/** @type {?string} */
@@ -42,7 +46,7 @@ export class FrameEndpoint {
}
/** @type {import('frame-client').FrameEndpointReadyDetails} */
const details = {secret: this._secret};
- yomitan.api.broadcastTab({action: 'frameEndpointReady', params: details});
+ this._api.broadcastTab({action: 'frameEndpointReady', params: details});
}
/**
@@ -84,6 +88,6 @@ export class FrameEndpoint {
this._eventListeners.removeAllEventListeners();
/** @type {import('frame-client').FrameEndpointConnectedDetails} */
const details = {secret, token};
- yomitan.api.sendMessageToFrame(hostFrameId, {action: 'frameEndpointConnected', params: details});
+ this._api.sendMessageToFrame(hostFrameId, {action: 'frameEndpointConnected', params: details});
}
}