diff --git a/js/thirdparty/ejs-utils.js b/js/thirdparty/ejs-utils.js index 11b9852..9645427 100644 --- a/js/thirdparty/ejs-utils.js +++ b/js/thirdparty/ejs-utils.js @@ -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 ''; } }; + + 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);