summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
Diffstat (limited to 'ext')
-rw-r--r--ext/js/templates/template-renderer.js10
1 files changed, 9 insertions, 1 deletions
diff --git a/ext/js/templates/template-renderer.js b/ext/js/templates/template-renderer.js
index e27ad03c..a06298aa 100644
--- a/ext/js/templates/template-renderer.js
+++ b/ext/js/templates/template-renderer.js
@@ -29,6 +29,8 @@ class TemplateRenderer {
this._stateStack = null;
this._dataTypes = new Map();
this._requirements = null;
+ this._cleanupCallbacks = null;
+ this._customData = null;
}
registerDataType(name, {modifier=null, composeData=null}) {
@@ -85,15 +87,21 @@ class TemplateRenderer {
}
_renderTemplate(instance, data) {
+ const cleanupCallbacks = [];
+ const requirements = [];
try {
- const requirements = [];
+ this._customData = {};
this._stateStack = [new Map()];
this._requirements = requirements;
+ this._cleanupCallbacks = cleanupCallbacks;
const result = instance(data).trim();
return {result, requirements};
} finally {
+ for (const callback of cleanupCallbacks) { callback(); }
this._stateStack = null;
this._requirements = null;
+ this._cleanupCallbacks = null;
+ this._customData = null;
}
}