mirror of
https://github.com/Equicord/Equicord.git
synced 2025-06-15 09:33:03 -04:00
Utility function for loading Discord chunks (#2017)
This commit is contained in:
parent
1b179f3c6d
commit
1619ee404a
4 changed files with 118 additions and 27 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue