diff options
author | Alex Yatskov <alex@foosoft.net> | 2016-10-11 19:45:36 -0700 |
---|---|---|
committer | Alex Yatskov <alex@foosoft.net> | 2016-10-11 19:45:36 -0700 |
commit | 82162a071a518bef3a0bc85d00cbf2bbe5d37038 (patch) | |
tree | dec61bb9b05c8e5a9db69378c349631dc6e42e37 /ext/bg/js/anki.js | |
parent | a949e66a6c244447e6e3b28b4a24954e68f0be5d (diff) |
WIP
Diffstat (limited to 'ext/bg/js/anki.js')
-rw-r--r-- | ext/bg/js/anki.js | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/ext/bg/js/anki.js b/ext/bg/js/anki.js index a359f021..66cea094 100644 --- a/ext/bg/js/anki.js +++ b/ext/bg/js/anki.js @@ -43,6 +43,18 @@ class AnkiConnect { return this.ankiInvokeSafe('modelFieldNames', {modelName}, null); } + getStatus() { + return this.getVersion().then(version => { + if (version === null) { + return 'disconnected'; + } else if (version === this.apiVersion) { + return 'ready'; + } else { + return 'mismatch'; + } + }); + } + getVersion() { return this.ankiInvoke('version', {}, null); } |