mirror of
https://github.com/SamEyeBam/animate.git
synced 2025-09-28 23:15:25 +00:00
larry babby and threejs for glsl
This commit is contained in:
29
webGl/my-threejs-test/node_modules/@parcel/runtime-js/src/helpers/cacheLoader.js
generated
vendored
Normal file
29
webGl/my-threejs-test/node_modules/@parcel/runtime-js/src/helpers/cacheLoader.js
generated
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
let cachedBundles = {};
|
||||
let cachedPreloads = {};
|
||||
let cachedPrefetches = {};
|
||||
|
||||
function getCache(type) {
|
||||
switch (type) {
|
||||
case 'preload':
|
||||
return cachedPreloads;
|
||||
case 'prefetch':
|
||||
return cachedPrefetches;
|
||||
default:
|
||||
return cachedBundles;
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = function cacheLoader(loader, type) {
|
||||
return function (bundle) {
|
||||
let cache = getCache(type);
|
||||
|
||||
if (cache[bundle]) {
|
||||
return cache[bundle];
|
||||
}
|
||||
|
||||
return (cache[bundle] = loader.apply(null, arguments).catch(function (e) {
|
||||
delete cache[bundle];
|
||||
throw e;
|
||||
}));
|
||||
};
|
||||
};
|
Reference in New Issue
Block a user