summaryrefslogtreecommitdiff
path: root/ext/js/comm/frame-endpoint.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-endpoint.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-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});
}
}