window.kachingBundlesEnabled = true;
window.kachingBundlesInitialized = false;
// Allow calling kachingBundlesInitialize before the script is loaded
(() => {
let shouldInitialize = false;
let realInitialize = null;
window.kachingBundlesInitialize = () => {
if (realInitialize) {
realInitialize();
} else {
shouldInitialize = true;
}
};
Object.defineProperty(window, '__kachingBundlesInitializeInternal', {
set(fn) {
realInitialize = fn;
if (shouldInitialize) {
shouldInitialize = false;
fn();
}
},
get() {
return realInitialize;
}
});
})();