aboutsummaryrefslogtreecommitdiff
path: root/ext/js/background/offscreen.js
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2023-12-20 00:43:41 -0500
committerGitHub <noreply@github.com>2023-12-20 05:43:41 +0000
commitad94a56e573553f3c66e8fcccff3042544faeb1b (patch)
treed5ea82322e9face770f709520c219e1b6edf4893 /ext/js/background/offscreen.js
parentd6dcf8288a77996d2aba989a26d2a21f7ebf4b33 (diff)
Add Offscreen.prepare for constructor side effects (#402)
Diffstat (limited to 'ext/js/background/offscreen.js')
-rw-r--r--ext/js/background/offscreen.js8
1 files changed, 5 insertions, 3 deletions
diff --git a/ext/js/background/offscreen.js b/ext/js/background/offscreen.js
index bcbcda6b..d1cf3384 100644
--- a/ext/js/background/offscreen.js
+++ b/ext/js/background/offscreen.js
@@ -68,13 +68,15 @@ export class Offscreen {
]));
/* eslint-enable no-multi-spaces */
- const onMessage = this._onMessage.bind(this);
- chrome.runtime.onMessage.addListener(onMessage);
-
/** @type {?Promise<void>} */
this._prepareDatabasePromise = null;
}
+ /** */
+ prepare() {
+ chrome.runtime.onMessage.addListener(this._onMessage.bind(this));
+ }
+
/** @type {import('offscreen').MessageHandler<'clipboardGetTextOffscreen', true>} */
async _getTextHandler({useRichText}) {
return await this._clipboardReader.getText(useRichText);