diff options
author | Alex Yatskov <alex@foosoft.net> | 2017-07-01 18:27:49 -0700 |
---|---|---|
committer | Alex Yatskov <alex@foosoft.net> | 2017-07-01 18:27:49 -0700 |
commit | d57c5530b7ad56a7cc89782b4d186d8fddb55d86 (patch) | |
tree | 09cce1fded053b04ea716c2d4d44fb4676b24800 /ext/bg/js/anki-connect.js | |
parent | 390cb12896607144fcd1046950f3a2aa680db71b (diff) |
view added notes
Diffstat (limited to 'ext/bg/js/anki-connect.js')
-rw-r--r-- | ext/bg/js/anki-connect.js | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/ext/bg/js/anki-connect.js b/ext/bg/js/anki-connect.js index 9759c8f5..173feefd 100644 --- a/ext/bg/js/anki-connect.js +++ b/ext/bg/js/anki-connect.js @@ -26,7 +26,7 @@ class AnkiConnect { } addNote(note) { - return this.checkVersion().then(() => this.ankiInvoke('addNote', {note}, null)); + return this.checkVersion().then(() => this.ankiInvoke('addNote', {note})); } canAddNotes(notes) { @@ -34,15 +34,19 @@ class AnkiConnect { } getDeckNames() { - return this.checkVersion().then(() => this.ankiInvoke('deckNames', {}, null)); + return this.checkVersion().then(() => this.ankiInvoke('deckNames', {})); } getModelNames() { - return this.checkVersion().then(() => this.ankiInvoke('modelNames', {}, null)); + return this.checkVersion().then(() => this.ankiInvoke('modelNames', {})); } getModelFieldNames(modelName) { - return this.checkVersion().then(() => this.ankiInvoke('modelFieldNames', {modelName}, null)); + return this.checkVersion().then(() => this.ankiInvoke('modelFieldNames', {modelName})); + } + + guiBrowse(query) { + return this.checkVersion().then(() => this.ankiInvoke('guiBrowse', {query})); } checkVersion() { @@ -60,13 +64,13 @@ class AnkiConnect { ankiInvoke(action, params, pool) { return new Promise((resolve, reject) => { - if (pool !== null && this.asyncPools.hasOwnProperty(pool)) { + if (pool && this.asyncPools.hasOwnProperty(pool)) { this.asyncPools[pool].abort(); } const xhr = new XMLHttpRequest(); xhr.addEventListener('loadend', () => { - if (pool !== null) { + if (pool) { delete this.asyncPools[pool]; } |