fix(lib/modules/metro/subscriptions): run catching subscriptions
This commit is contained in:
parent
66d95a8c49
commit
c532f5c3fd
1 changed files with 24 additions and 5 deletions
|
|
@ -18,9 +18,17 @@ export const sInitialize = new Map<
|
|||
export const sImportedPath = new Set<ModuleFinishedImportingCallback>()
|
||||
|
||||
export function executeRequireSubscriptions(id: Metro.ModuleID) {
|
||||
for (const cb of sRequireAny) cb(id)
|
||||
for (const cb of sRequireAny)
|
||||
try {
|
||||
cb(id)
|
||||
} catch {}
|
||||
|
||||
if (sRequire.has(id)) {
|
||||
for (const cb of sRequire.get(id)!) cb(id)
|
||||
for (const cb of sRequire.get(id)!)
|
||||
try {
|
||||
cb(id)
|
||||
} catch {}
|
||||
|
||||
sRequire.delete(id)
|
||||
}
|
||||
}
|
||||
|
|
@ -29,9 +37,17 @@ export function executeInitializeSubscriptions(
|
|||
id: Metro.ModuleID,
|
||||
exports: Metro.ModuleExports,
|
||||
) {
|
||||
for (const cb of sInitializeAny) cb(id, exports)
|
||||
for (const cb of sInitializeAny)
|
||||
try {
|
||||
cb(id, exports)
|
||||
} catch {}
|
||||
|
||||
if (sInitialize.has(id)) {
|
||||
for (const cb of sInitialize.get(id)!) cb(id, exports)
|
||||
for (const cb of sInitialize.get(id)!)
|
||||
try {
|
||||
cb(id, exports)
|
||||
} catch {}
|
||||
|
||||
sInitialize.delete(id)
|
||||
}
|
||||
}
|
||||
|
|
@ -40,5 +56,8 @@ export function executeImportedPathSubscriptions(
|
|||
id: Metro.ModuleID,
|
||||
path: string,
|
||||
) {
|
||||
for (const cb of sImportedPath) cb(id, path)
|
||||
for (const cb of sImportedPath)
|
||||
try {
|
||||
cb(id, path)
|
||||
} catch {}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue