aboutsummaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2019-12-09 21:31:03 -0500
committertoasted-nutbread <toasted-nutbread@users.noreply.github.com>2019-12-13 23:11:56 -0500
commitf07207c9bfd940cc77345d38cbfd780fda1e065c (patch)
tree91c42d376d25869186ee0e9215a431f172a73bc0 /ext
parent5a743505528cc2cc96ab6bf41a7460c75f6c084c (diff)
Move apiTemplateRender implementation into Backend
Diffstat (limited to 'ext')
-rw-r--r--ext/bg/js/api.js8
-rw-r--r--ext/bg/js/backend.js8
2 files changed, 8 insertions, 8 deletions
diff --git a/ext/bg/js/api.js b/ext/bg/js/api.js
index 9de1fb4b..f4818854 100644
--- a/ext/bg/js/api.js
+++ b/ext/bg/js/api.js
@@ -61,12 +61,8 @@ function apiNoteView(noteId) {
return utilBackend()._onApiNoteView({noteId});
}
-async function apiTemplateRender(template, data, dynamic) {
- if (dynamic) {
- return handlebarsRenderDynamic(template, data);
- } else {
- return handlebarsRenderStatic(template, data);
- }
+function apiTemplateRender(template, data, dynamic) {
+ return utilBackend()._onApiTemplateRender({template, data, dynamic});
}
async function apiCommandExec(command, params) {
diff --git a/ext/bg/js/backend.js b/ext/bg/js/backend.js
index 4db88365..38dbd0f1 100644
--- a/ext/bg/js/backend.js
+++ b/ext/bg/js/backend.js
@@ -389,8 +389,12 @@ class Backend {
return this.anki.guiBrowse(`nid:${noteId}`);
}
- _onApiTemplateRender({template, data, dynamic}) {
- return apiTemplateRender(template, data, dynamic);
+ async _onApiTemplateRender({template, data, dynamic}) {
+ return (
+ dynamic ?
+ handlebarsRenderDynamic(template, data) :
+ handlebarsRenderStatic(template, data)
+ );
}
_onApiCommandExec({command, params}) {