diff options
author | siikamiika <siikamiika@users.noreply.github.com> | 2020-03-04 05:30:48 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-04 05:30:48 +0200 |
commit | 6e47b4e241594d68384f62b1faa34c86f85addbf (patch) | |
tree | d70452c259d1aeff36c7a9485cca137b64c58405 /ext/bg/js/util.js | |
parent | 46fee07d36b3966af9bacca8c6253b044bde07ee (diff) | |
parent | de8d9e6bf12f693d6579a2fb965fd7597a04288c (diff) |
Merge pull request #386 from siikamiika/simplify-backend-prepare
Simplify backend prepare
Diffstat (limited to 'ext/bg/js/util.js')
-rw-r--r-- | ext/bg/js/util.js | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/ext/bg/js/util.js b/ext/bg/js/util.js index 5ce4b08c..79c6af06 100644 --- a/ext/bg/js/util.js +++ b/ext/bg/js/util.js @@ -73,7 +73,11 @@ function utilStringHashCode(string) { } function utilBackend() { - return chrome.extension.getBackgroundPage().yomichanBackend; + const backend = chrome.extension.getBackgroundPage().yomichanBackend; + if (!backend.isPrepared) { + throw new Error('Backend not ready yet'); + } + return backend; } async function utilAnkiGetModelNames() { |