aboutsummaryrefslogtreecommitdiff
path: root/ext/bg/js/ankiconnect.js
diff options
context:
space:
mode:
authorAlex Yatskov <alex@foosoft.net>2017-02-05 11:44:59 -0800
committerAlex Yatskov <alex@foosoft.net>2017-02-05 11:44:59 -0800
commit5076b80f9690a12fda23d06b2c3ddd1df08cff56 (patch)
tree9f04555e22dd1387d8e3d80930e8a30497cd0719 /ext/bg/js/ankiconnect.js
parenta13c32a784ec41c9e46d841c14e790ffa4ab7466 (diff)
tweaks for ankiconnect1.0.8
Diffstat (limited to 'ext/bg/js/ankiconnect.js')
-rw-r--r--ext/bg/js/ankiconnect.js9
1 files changed, 5 insertions, 4 deletions
diff --git a/ext/bg/js/ankiconnect.js b/ext/bg/js/ankiconnect.js
index d17f3268..f6f94329 100644
--- a/ext/bg/js/ankiconnect.js
+++ b/ext/bg/js/ankiconnect.js
@@ -17,7 +17,8 @@
*/
class AnkiConnect {
- constructor() {
+ constructor(server) {
+ this.server = server;
this.asyncPools = {};
this.localVersion = 1;
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}));
});
}