aboutsummaryrefslogtreecommitdiff
path: root/ext/bg/js/anki.js
diff options
context:
space:
mode:
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);
}