summaryrefslogtreecommitdiff
path: root/ext/bg/js/yomichan.js
diff options
context:
space:
mode:
Diffstat (limited to 'ext/bg/js/yomichan.js')
-rw-r--r--ext/bg/js/yomichan.js24
1 files changed, 17 insertions, 7 deletions
diff --git a/ext/bg/js/yomichan.js b/ext/bg/js/yomichan.js
index 14d311c0..88280ab0 100644
--- a/ext/bg/js/yomichan.js
+++ b/ext/bg/js/yomichan.js
@@ -51,19 +51,29 @@ class Yomichan {
onMessage(request, sender, callback) {
const {action, params} = request, handlers = {
- canAddNotes: ({definitions, modes}) => this.ankiInvoke('canAddNotes', {definitions: definitions, modes: modes}, 'notes', callback),
- addNote: ({definition, mode}) => this.ankiInvoke('addNote', {definition: definition, mode: mode}, null, callback),
- findKanji: (text) => callback(this.translator.findKanji(text)),
- findTerm: (text) => callback(this.translator.findTerm(text)),
- getOptions: () => callback(this.options),
- getState: () => callback(this.state),
- renderText: ({data, template}) => callback(Handlebars.templates[template](data))
+ addNote: ({definition, mode}) => this.ankiInvoke('addNote', {definition: definition, mode: mode}, null, callback),
+ canAddNotes: ({definitions, modes}) => this.ankiInvoke('canAddNotes', {definitions: definitions, modes: modes}, 'notes', callback),
+ findKanji: (text) => callback(this.translator.findKanji(text)),
+ findTerm: (text) => callback(this.translator.findTerm(text)),
+ getDeckNames: () => this.getDeckNames(callback),
+ getModelNames: () => this.getModelNames(callback),
+ getOptions: () => callback(this.options),
+ getState: () => callback(this.state),
+ renderText: ({data, template}) => callback(Handlebars.templates[template](data))
};
handlers[action].call(this, params);
return true;
}
+ getDeckNames(callback) {
+ this.ankiInvoke('deckNames', {}, null, callback);
+ }
+
+ getModelNames(callback) {
+ this.ankiInvoke('modelNames', {}, null, callback);
+ }
+
onBrowserAction(tab) {
switch (this.state) {
case 'disabled':