summaryrefslogtreecommitdiff
path: root/ext/bg/js/ankiconnect.js
diff options
context:
space:
mode:
authorAlex Yatskov <alex@foosoft.net>2017-02-26 11:05:41 -0800
committerAlex Yatskov <alex@foosoft.net>2017-02-26 11:05:41 -0800
commit32f95e59a9c5612d2b5658ea8a70b55ec17cca18 (patch)
treea75e426d9350f266402ff0e8a9d040a985a37629 /ext/bg/js/ankiconnect.js
parentb7faaf0b51363b8366adae3ba7511d5232d6cd30 (diff)
parent8966dc1213d4af15c956dbd8976b80a1287c9fe0 (diff)
Merge branch 'dev' into firefox
Diffstat (limited to 'ext/bg/js/ankiconnect.js')
-rw-r--r--ext/bg/js/ankiconnect.js11
1 files changed, 6 insertions, 5 deletions
diff --git a/ext/bg/js/ankiconnect.js b/ext/bg/js/ankiconnect.js
index d17f3268..3a6e3690 100644
--- a/ext/bg/js/ankiconnect.js
+++ b/ext/bg/js/ankiconnect.js
@@ -17,9 +17,10 @@
*/
class AnkiConnect {
- constructor() {
+ constructor(server) {
+ this.server = server;
this.asyncPools = {};
- this.localVersion = 1;
+ this.localVersion = 2;
this.remoteVersion = null;
}
@@ -50,8 +51,8 @@ class AnkiConnect {
return this.ankiInvoke('version', {}, null).then(version => {
this.remoteVersion = version;
- if (this.remoteVersion !== this.localVersion) {
- return Promise.reject('extension and plugin version mismatch');
+ if (this.remoteVersion < this.localVersion) {
+ return Promise.reject('extension and plugin versions incompatible');
}
});
}
@@ -75,7 +76,7 @@ class AnkiConnect {
}
});
- xhr.open('POST', 'http://127.0.0.1:8765');
+ xhr.open('POST', this.server);
xhr.send(JSON.stringify({action, params}));
});
}