Update handlebars cache
This commit is contained in:
parent
2519f99f54
commit
d7bf128333
@ -141,12 +141,13 @@ function handlebarsRenderStatic(name, data) {
|
|||||||
|
|
||||||
function handlebarsRenderDynamic(template, data) {
|
function handlebarsRenderDynamic(template, data) {
|
||||||
handlebarsRegisterHelpers();
|
handlebarsRegisterHelpers();
|
||||||
|
const cache = handlebarsRenderDynamic._cache;
|
||||||
Handlebars.yomichan_cache = Handlebars.yomichan_cache || {};
|
let instance = cache.get(template);
|
||||||
let instance = Handlebars.yomichan_cache[template];
|
if (typeof instance === 'undefined') {
|
||||||
if (!instance) {
|
instance = Handlebars.compile(template);
|
||||||
instance = Handlebars.yomichan_cache[template] = Handlebars.compile(template);
|
cache.set(template, instance);
|
||||||
}
|
}
|
||||||
|
|
||||||
return instance(data).trim();
|
return instance(data).trim();
|
||||||
}
|
}
|
||||||
|
handlebarsRenderDynamic._cache = new Map();
|
||||||
|
Loading…
Reference in New Issue
Block a user