diff options
author | toasted-nutbread <toasted-nutbread@users.noreply.github.com> | 2021-02-14 15:19:31 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-14 15:19:31 -0500 |
commit | efe8140f103179f50b610f182148b9427af99010 (patch) | |
tree | 94afdefddf9985d2ec11cdcd9a1e2638e2005b3d /ext/js/yomichan.js | |
parent | 94201ed44ac1835637e77a6a7f583aca70bbf2d3 (diff) |
Api prepare refactor (#1391)
* Refactor API preparation
* Run yomichan.prepare manually in the entry point function
Diffstat (limited to 'ext/js/yomichan.js')
-rw-r--r-- | ext/js/yomichan.js | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/ext/js/yomichan.js b/ext/js/yomichan.js index 61301e30..7d101a4c 100644 --- a/ext/js/yomichan.js +++ b/ext/js/yomichan.js @@ -71,13 +71,13 @@ const yomichan = (() => { return this._isExtensionUnloaded; } - prepare() { + async prepare(isBackground=false) { chrome.runtime.onMessage.addListener(this._onMessage.bind(this)); - } - backendReady() { - this.sendMessage({action: 'requestBackendReadySignal'}); - return this._isBackendReadyPromise; + if (!isBackground) { + this.sendMessage({action: 'requestBackendReadySignal'}); + await this._isBackendReadyPromise; + } } ready() { @@ -302,5 +302,3 @@ const yomichan = (() => { return new Yomichan(); })(); - -yomichan.prepare(); |