Utility function for loading Discord chunks (#2017)

This commit is contained in:
Nuckyz 2023-11-27 02:56:57 -03:00
parent 1b179f3c6d
commit 1619ee404a
No known key found for this signature in database
GPG key ID: 440BF8296E1C4AD9
4 changed files with 118 additions and 27 deletions

View file

@ -152,11 +152,9 @@ function patchFactories(factories: Record<string | number, (module: { exports: a
return;
}
const numberId = Number(id);
for (const callback of listeners) {
try {
callback(exports, numberId);
callback(exports, id);
} catch (err) {
logger.error("Error in webpack listener", err);
}
@ -166,10 +164,10 @@ function patchFactories(factories: Record<string | number, (module: { exports: a
try {
if (filter(exports)) {
subscriptions.delete(filter);
callback(exports, numberId);
callback(exports, id);
} else if (exports.default && filter(exports.default)) {
subscriptions.delete(filter);
callback(exports.default, numberId);
callback(exports.default, id);
}
} catch (err) {
logger.error("Error while firing callback for webpack chunk", err);