aboutsummaryrefslogtreecommitdiff
path: root/ext/bg/js/backend.js
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2020-06-15 20:11:54 -0400
committerGitHub <noreply@github.com>2020-06-15 20:11:54 -0400
commit6562d0c1e507b17ab929ed9525666a08084404fa (patch)
tree8e906d7fb36280c06c03c3a8886e4628a44cef05 /ext/bg/js/backend.js
parentb4a617cac3dea5f5efcd95514fa680fbcd7dd9fb (diff)
Template renderer class (#574)
* Convert handlebars.js to a class * Move/rename function * Update helper registration * Rename helper functions * Limit cache size * Make render() async * Rename and move
Diffstat (limited to 'ext/bg/js/backend.js')
-rw-r--r--ext/bg/js/backend.js5
1 files changed, 3 insertions, 2 deletions
diff --git a/ext/bg/js/backend.js b/ext/bg/js/backend.js
index 0c7a0301..93ba620f 100644
--- a/ext/bg/js/backend.js
+++ b/ext/bg/js/backend.js
@@ -27,10 +27,10 @@
* JsonSchema
* Mecab
* ObjectPropertyAccessor
+ * TemplateRenderer
* Translator
* conditionsTestValue
* dictTermsSort
- * handlebarsRenderDynamic
* jp
* optionsLoad
* optionsSave
@@ -63,6 +63,7 @@ class Backend {
audioSystem: this.audioSystem,
renderTemplate: this._renderTemplate.bind(this)
});
+ this._templateRenderer = new TemplateRenderer();
const url = (typeof window === 'object' && window !== null ? window.location.href : '');
this.optionsContext = {depth: 0, url};
@@ -1230,7 +1231,7 @@ class Backend {
}
async _renderTemplate(template, data) {
- return handlebarsRenderDynamic(template, data);
+ return await this._templateRenderer.render(template, data);
}
_getTemplates(options) {