update ejs-utils

This commit is contained in:
s2
2019-04-14 13:22:19 +02:00
parent 3179f5581e
commit f4f96fa7e9

View File

@@ -1,5 +1,6 @@
//if this does not work, call Simon. https://github.com/S2-
//this uses jQuery for now because ie11 support is needed
(function($) {
var uuidv4 = function() {
@@ -49,4 +50,28 @@
return '<span class="ejs-templateplaceholder" style="display: none;" id="' + r + '"></span>';
}
};
ejs.preloadTft = function(templateUrl) {
var d = $.Deferred();
//if the template is already cached, just return.
if (ejs.cache.get(templateUrl)) {
d.resolve();
} else {
$.get(templateUrl)
.then(function(template) {
var templateFn = ejs.compile(template,
{
cache: true,
filename: templateUrl
});
ejs.cache.set(templateUrl, templateFn);
d.resolve();
});
}
return d;
}
})(jQuery);