Move apiTemplateRender implementation into Backend

This commit is contained in:
toasted-nutbread 2019-12-09 21:31:03 -05:00
parent 5a74350552
commit f07207c9bf
2 changed files with 8 additions and 8 deletions

View File

@ -61,12 +61,8 @@ function apiNoteView(noteId) {
return utilBackend()._onApiNoteView({noteId}); return utilBackend()._onApiNoteView({noteId});
} }
async function apiTemplateRender(template, data, dynamic) { function apiTemplateRender(template, data, dynamic) {
if (dynamic) { return utilBackend()._onApiTemplateRender({template, data, dynamic});
return handlebarsRenderDynamic(template, data);
} else {
return handlebarsRenderStatic(template, data);
}
} }
async function apiCommandExec(command, params) { async function apiCommandExec(command, params) {

View File

@ -389,8 +389,12 @@ class Backend {
return this.anki.guiBrowse(`nid:${noteId}`); return this.anki.guiBrowse(`nid:${noteId}`);
} }
_onApiTemplateRender({template, data, dynamic}) { async _onApiTemplateRender({template, data, dynamic}) {
return apiTemplateRender(template, data, dynamic); return (
dynamic ?
handlebarsRenderDynamic(template, data) :
handlebarsRenderStatic(template, data)
);
} }
_onApiCommandExec({command, params}) { _onApiCommandExec({command, params}) {