feat: Context Menu API (#496)

This commit is contained in:
Nuckyz 2023-03-08 01:59:50 -03:00 committed by GitHub
parent 40395d562a
commit 1b199ec5d8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 236 additions and 13 deletions

View file

@ -92,9 +92,11 @@ function patchPush() {
return;
}
const numberId = Number(id);
for (const callback of listeners) {
try {
callback(exports);
callback(exports, numberId);
} catch (err) {
logger.error("Error in webpack listener", err);
}
@ -104,17 +106,17 @@ function patchPush() {
try {
if (filter(exports)) {
subscriptions.delete(filter);
callback(exports);
callback(exports, numberId);
} else if (typeof exports === "object") {
if (exports.default && filter(exports.default)) {
subscriptions.delete(filter);
callback(exports.default);
callback(exports.default, numberId);
}
for (const nested in exports) if (nested.length <= 3) {
if (exports[nested] && filter(exports[nested])) {
subscriptions.delete(filter);
callback(exports[nested]);
callback(exports[nested], numberId);
}
}
}