Son CV dans un terminal web en Javascript! https://terminal-cv.gregandev.fr
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

33 lines
588 B

"use strict";
var cachedBundles = {};
var cachedPreloads = {};
var cachedPrefetches = {};
function getCache(type) {
switch (type) {
case 'preload':
return cachedPreloads;
case 'prefetch':
return cachedPrefetches;
default:
return cachedBundles;
}
}
module.exports = function (loader, type) {
return function (bundle) {
var cache = getCache(type);
if (cache[bundle]) {
return cache[bundle];
}
return cache[bundle] = loader.apply(null, arguments).catch(function (e) {
delete cache[bundle];
throw e;
});
};
};