Make reporter faster

This commit is contained in:
Nuckyz 2024-05-23 21:57:12 -03:00
parent f5be78d101
commit 8e9434cdd5
No known key found for this signature in database
GPG key ID: 440BF8296E1C4AD9

View file

@ -440,10 +440,13 @@ async function runtime(token: string) {
wreq = webpackRequire; wreq = webpackRequire;
Vencord.Webpack.factoryListeners.add(factory => { Vencord.Webpack.factoryListeners.add(factory => {
// setImmediate to avoid blocking the factory patching execution while checking for lazy chunks
setTimeout(() => {
let isResolved = false; let isResolved = false;
searchAndLoadLazyChunks(String(factory)).then(() => isResolved = true); searchAndLoadLazyChunks(String(factory)).then(() => isResolved = true);
chunksSearchPromises.push(() => isResolved); chunksSearchPromises.push(() => isResolved);
}, 0);
}); });
// setImmediate to only search the initial factories after Discord initialized the app // setImmediate to only search the initial factories after Discord initialized the app