greglebreton 4e8a693745
Some checks failed
continuous-integration/drone/push Build is failing
add garagenum exp + maj url site projets
2023-01-08 16:50:31 +01:00

33 lines
588 B
JavaScript

"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;
});
};
};