[Representation] Test template prefetcher

This commit is contained in:
Victor Woeltjen
2015-12-08 13:29:11 -08:00
parent f8809ce67f
commit b2f5861458
3 changed files with 87 additions and 8 deletions

View File

@ -25,10 +25,6 @@ define(
function () {
'use strict';
function concat(a, b) {
return a.concat(b);
}
/**
* Loads all templates when the application is started.
* @param {platform/representation.TemplateLinker} templateLinker
@ -39,9 +35,15 @@ define(
*/
function TemplatePrefetcher(templateLinker, extensions) {
Array.prototype.slice.apply(arguments, [1])
.reduce(concat, [])
.map(templateLinker.getPath.bind(templateLinker))
.forEach(templateLinker.load.bind(templateLinker));
.reduce(function (a, b) {
return a.concat(b);
}, [])
.map(function (ext) {
return templateLinker.getPath(ext);
})
.forEach(function (path) {
templateLinker.load(path);
});
}
return TemplatePrefetcher;