aboutsummaryrefslogtreecommitdiff
path: root/js/luigi-template.js
diff options
context:
space:
mode:
authorPaul Duncan <pabs@pablotron.org>2018-09-09 11:02:08 -0400
committerPaul Duncan <pabs@pablotron.org>2018-09-09 11:02:08 -0400
commitc0f4d9a505ab1a94e6b0993582c9827f5a681e05 (patch)
tree250ed30d37b8a775153acfd5514dd76229a1f1fb /js/luigi-template.js
parentb4e1f4906a27619b3edffd791361694f00f38662 (diff)
downloadluigi-template-c0f4d9a505ab1a94e6b0993582c9827f5a681e05.tar.bz2
luigi-template-c0f4d9a505ab1a94e6b0993582c9827f5a681e05.zip
js: add to Usage, fix cache test, add support for cache custom filters
Diffstat (limited to 'js/luigi-template.js')
-rw-r--r--js/luigi-template.js9
1 files changed, 5 insertions, 4 deletions
diff --git a/js/luigi-template.js b/js/luigi-template.js
index 473938f..f01d976 100644
--- a/js/luigi-template.js
+++ b/js/luigi-template.js
@@ -288,8 +288,9 @@ LuigiTemplate = (function() {
T.prototype.run = run;
// declare cache constructor
- T.Cache = function(templates, try_dom) {
+ T.Cache = function(templates, filters, try_dom) {
this.templates = templates;
+ this.filters = filters || FILTERS;
this.try_dom = !!try_dom;
this.cache = {};
};
@@ -310,15 +311,15 @@ LuigiTemplate = (function() {
}
// cache template
- this.cache[key] = new T(s);
+ this.cache[key] = new T(s, this.filters);
}
// run template
return this.cache[key].run(args);
};
- T.cache = function(args) {
- return new T.Cache(args);
+ T.cache = function(args, filters) {
+ return new T.Cache(args, filters || FILTERS);
}
// declare domcache constructor