aboutsummaryrefslogtreecommitdiff
path: root/ext/bg/js/anki.js
diff options
context:
space:
mode:
authorAlex Yatskov <alex@foosoft.net>2016-10-11 19:45:36 -0700
committerAlex Yatskov <alex@foosoft.net>2016-10-11 19:45:36 -0700
commit82162a071a518bef3a0bc85d00cbf2bbe5d37038 (patch)
treedec61bb9b05c8e5a9db69378c349631dc6e42e37 /ext/bg/js/anki.js
parenta949e66a6c244447e6e3b28b4a24954e68f0be5d (diff)
WIP
Diffstat (limited to 'ext/bg/js/anki.js')
-rw-r--r--ext/bg/js/anki.js12
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);
}