summaryrefslogtreecommitdiff
path: root/ext/bg/js/api.js
diff options
context:
space:
mode:
authorAlex Yatskov <alex@foosoft.net>2017-09-11 16:56:27 -0700
committerAlex Yatskov <alex@foosoft.net>2017-09-11 16:56:27 -0700
commit3a1aad07d61411f634e86f905babd6fbbac2eae1 (patch)
treef343fc427c0c791823a39a482dc3d1cd35d34253 /ext/bg/js/api.js
parent65b679caeb7ae7261ea6f2ba76d1b14ff1d68c5c (diff)
parent2eb85cb835a4aece7839eba25c0030e9eb186f85 (diff)
Merge branch 'master' into firefox-amo
Diffstat (limited to 'ext/bg/js/api.js')
-rw-r--r--ext/bg/js/api.js14
1 files changed, 10 insertions, 4 deletions
diff --git a/ext/bg/js/api.js b/ext/bg/js/api.js
index 96147d95..5c1aebb6 100644
--- a/ext/bg/js/api.js
+++ b/ext/bg/js/api.js
@@ -62,7 +62,8 @@ async function apiDefinitionAdd(definition, mode) {
);
}
- return utilBackend().anki.addNote(dictNoteFormat(definition, mode, options));
+ const note = await dictNoteFormat(definition, mode, options);
+ return utilBackend().anki.addNote(note);
}
async function apiDefinitionsAddable(definitions, modes) {
@@ -72,7 +73,8 @@ async function apiDefinitionsAddable(definitions, modes) {
const notes = [];
for (const definition of definitions) {
for (const mode of modes) {
- notes.push(dictNoteFormat(definition, mode, utilBackend().options));
+ const note = await dictNoteFormat(definition, mode, utilBackend().options);
+ notes.push(note);
}
}
@@ -96,8 +98,12 @@ async function apiNoteView(noteId) {
return utilBackend().anki.guiBrowse(`nid:${noteId}`);
}
-async function apiTemplateRender(template, data) {
- return handlebarsRender(template, data);
+async function apiTemplateRender(template, data, dynamic) {
+ if (dynamic) {
+ return handlebarsRenderDynamic(template, data);
+ } else {
+ return handlebarsRenderStatic(template, data);
+ }
}
async function apiCommandExec(command) {