summaryrefslogtreecommitdiff
path: root/ext/bg/js/handlebars.js
diff options
context:
space:
mode:
Diffstat (limited to 'ext/bg/js/handlebars.js')
-rw-r--r--ext/bg/js/handlebars.js11
1 files changed, 6 insertions, 5 deletions
diff --git a/ext/bg/js/handlebars.js b/ext/bg/js/handlebars.js
index 8f43cf9a..b57ba738 100644
--- a/ext/bg/js/handlebars.js
+++ b/ext/bg/js/handlebars.js
@@ -141,12 +141,13 @@ function handlebarsRenderStatic(name, data) {
function handlebarsRenderDynamic(template, data) {
handlebarsRegisterHelpers();
-
- Handlebars.yomichan_cache = Handlebars.yomichan_cache || {};
- let instance = Handlebars.yomichan_cache[template];
- if (!instance) {
- instance = Handlebars.yomichan_cache[template] = Handlebars.compile(template);
+ const cache = handlebarsRenderDynamic._cache;
+ let instance = cache.get(template);
+ if (typeof instance === 'undefined') {
+ instance = Handlebars.compile(template);
+ cache.set(template, instance);
}
return instance(data).trim();
}
+handlebarsRenderDynamic._cache = new Map();