aboutsummaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorAlex Yatskov <alex@foosoft.net>2017-07-29 08:55:29 -0700
committerAlex Yatskov <alex@foosoft.net>2017-07-29 08:55:29 -0700
commitfea35435b22a4eeadbfcc5f29d5f9518700d4306 (patch)
tree48c11e67a2b431af06de89e2d0796ba189d3ad32 /ext
parentba155e77063bd86fb5751656d8d5d462a129214f (diff)
cleanup
Diffstat (limited to 'ext')
-rw-r--r--ext/bg/js/anki-connect.js2
-rw-r--r--ext/bg/js/api.js11
2 files changed, 6 insertions, 7 deletions
diff --git a/ext/bg/js/anki-connect.js b/ext/bg/js/anki-connect.js
index 567e8d3f..80c075fd 100644
--- a/ext/bg/js/anki-connect.js
+++ b/ext/bg/js/anki-connect.js
@@ -58,7 +58,7 @@ class AnkiConnect {
if (this.remoteVersion < this.localVersion) {
this.remoteVersion = await this.ankiInvoke('version');
if (this.remoteVersion < this.localVersion) {
- return Promise.reject('extension and plugin versions incompatible');
+ throw 'extension and plugin versions incompatible';
}
}
}
diff --git a/ext/bg/js/api.js b/ext/bg/js/api.js
index 11267918..ac53a7a3 100644
--- a/ext/bg/js/api.js
+++ b/ext/bg/js/api.js
@@ -84,8 +84,9 @@ function utilCommandDispatch(command) {
},
toggle: () => {
- this.options.general.enable = !this.options.general.enable;
- optionsSave(this.options).then(() => this.optionsSet(this.options));
+ const options = chrome.extension.getBackgroundPage().yomichan.options;
+ options.general.enable = !options.general.enable;
+ optionsSave(options).then(() => apiOptionsSet(options));
}
};
@@ -96,8 +97,7 @@ function utilCommandDispatch(command) {
}
function utilNoteFormat(definition, mode) {
- const yomichan = chrome.extension.getBackgroundPage().yomichan;
- const options = yomichan.options;
+ const options = chrome.extension.getBackgroundPage().yomichan.options;
const note = {fields: {}, tags: options.anki.tags};
let fields = [];
@@ -174,8 +174,7 @@ async function apiOptionsSet(options) {
}
async function apiOptionsGet() {
- const yomichan = chrome.extension.getBackgroundPage().yomichan;
- return yomichan.options;
+ return chrome.extension.getBackgroundPage().yomichan.options;
}
async function apiTermsFind(text) {