summaryrefslogtreecommitdiff
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.js9
1 files changed, 9 insertions, 0 deletions
diff --git a/ext/bg/js/anki.js b/ext/bg/js/anki.js
index 84d81d49..8395518f 100644
--- a/ext/bg/js/anki.js
+++ b/ext/bg/js/anki.js
@@ -40,6 +40,15 @@ class AnkiConnect {
this._enabled = value;
}
+ async isConnected() {
+ try {
+ await this._invoke('version');
+ return true;
+ } catch (e) {
+ return false;
+ }
+ }
+
async addNote(note) {
if (!this._enabled) { return null; }
await this._checkVersion();