animate/webGl/my-threejs-test/node_modules/@parcel/runtime-js/lib/helpers/cacheLoader.js

27 lines
582 B
JavaScript
Raw Normal View History

2024-06-24 09:24:00 +00:00
"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;
});
};
};