Fix occasional freezing on firefox (cache related)
This commit is contained in:
parent
d8cd557fb2
commit
a2a33ca62d
1 changed files with 21 additions and 15 deletions
|
@ -28,21 +28,27 @@ let webpackChunk: any[];
|
||||||
|
|
||||||
const logger = new Logger("WebpackInterceptor", "#8caaee");
|
const logger = new Logger("WebpackInterceptor", "#8caaee");
|
||||||
|
|
||||||
Object.defineProperty(window, WEBPACK_CHUNK, {
|
if (window[WEBPACK_CHUNK]) {
|
||||||
get: () => webpackChunk,
|
logger.info(`Patching ${WEBPACK_CHUNK}.push (was already existant, likely from cache!)`);
|
||||||
set: v => {
|
_initWebpack(window[WEBPACK_CHUNK]);
|
||||||
if (v?.push !== Array.prototype.push) {
|
patchPush();
|
||||||
logger.info(`Patching ${WEBPACK_CHUNK}.push`);
|
} else {
|
||||||
_initWebpack(v);
|
Object.defineProperty(window, WEBPACK_CHUNK, {
|
||||||
patchPush();
|
get: () => webpackChunk,
|
||||||
// @ts-ignore
|
set: v => {
|
||||||
delete window[WEBPACK_CHUNK];
|
if (v?.push !== Array.prototype.push) {
|
||||||
window[WEBPACK_CHUNK] = v;
|
logger.info(`Patching ${WEBPACK_CHUNK}.push`);
|
||||||
}
|
_initWebpack(v);
|
||||||
webpackChunk = v;
|
patchPush();
|
||||||
},
|
// @ts-ignore
|
||||||
configurable: true
|
delete window[WEBPACK_CHUNK];
|
||||||
});
|
window[WEBPACK_CHUNK] = v;
|
||||||
|
}
|
||||||
|
webpackChunk = v;
|
||||||
|
},
|
||||||
|
configurable: true
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
function patchPush() {
|
function patchPush() {
|
||||||
function handlePush(chunk: any) {
|
function handlePush(chunk: any) {
|
||||||
|
|
Loading…
Reference in a new issue