Use single instance of AnkiConnect

This commit is contained in:
toasted-nutbread 2020-04-12 12:38:33 -04:00
parent c41c7252ae
commit 4c2ca82a29
2 changed files with 4 additions and 3 deletions

View File

@ -25,7 +25,7 @@
class AnkiConnect {
constructor(server) {
this._enabled = true;
this._enabled = false;
this._server = server;
this._localVersion = 2;
this._remoteVersion = 0;

View File

@ -47,7 +47,7 @@ class Backend {
this.database = new Database();
this.dictionaryImporter = new DictionaryImporter();
this.translator = new Translator(this.database);
this.anki = new AnkiNull();
this.anki = new AnkiConnect();
this.mecab = new Mecab();
this.clipboardMonitor = new ClipboardMonitor({getClipboard: this._onApiClipboardGet.bind(this)});
this.options = null;
@ -210,7 +210,8 @@ class Backend {
this.setExtensionBadgeText('');
}
this.anki = options.anki.enable ? new AnkiConnect(options.anki.server) : new AnkiNull();
this.anki.setServer(options.anki.server);
this.anki.setEnabled(options.anki.enable);
if (options.parsing.enableMecabParser) {
this.mecab.startListener();