diff options
author | toasted-nutbread <toasted-nutbread@users.noreply.github.com> | 2021-02-14 15:53:35 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-14 15:53:35 -0500 |
commit | 286534e648af350d24fbf3c7892a7ec81aaeb4bd (patch) | |
tree | 89d88e961c5a0a6f508c66789e30b9ba4a968e73 /ext/js/settings/anki-templates-controller.js | |
parent | efe8140f103179f50b610f182148b9427af99010 (diff) |
Move api to yomichan object (#1392)
* Move cross frame API from API to Yomichan
* Add API instance to Yomichan
* Move api global to yomichan.api
* Pass yomichan to API
* Remove IIFE
Diffstat (limited to 'ext/js/settings/anki-templates-controller.js')
-rw-r--r-- | ext/js/settings/anki-templates-controller.js | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/ext/js/settings/anki-templates-controller.js b/ext/js/settings/anki-templates-controller.js index 31bd1e92..8e3a1a70 100644 --- a/ext/js/settings/anki-templates-controller.js +++ b/ext/js/settings/anki-templates-controller.js @@ -17,7 +17,6 @@ /* global * AnkiNoteBuilder - * api */ class AnkiTemplatesController { @@ -37,7 +36,7 @@ class AnkiTemplatesController { } async prepare() { - this._defaultFieldTemplates = await api.getDefaultAnkiFieldTemplates(); + this._defaultFieldTemplates = await yomichan.api.getDefaultAnkiFieldTemplates(); this._fieldTemplatesTextarea = document.querySelector('#anki-card-templates-textarea'); this._compileResultInfo = document.querySelector('#anki-card-templates-compile-result'); @@ -154,7 +153,7 @@ class AnkiTemplatesController { async _getDefinition(text, optionsContext) { if (this._cachedDefinitionText !== text) { - const {definitions} = await api.termsFind(text, {}, optionsContext); + const {definitions} = await yomichan.api.termsFind(text, {}, optionsContext); if (definitions.length === 0) { return null; } this._cachedDefinitionValue = definitions[0]; |