2025-03-30 23:32:17 +07:00
|
|
|
import type { ModuleInitializedCallback, ModuleWithImportedPathInitializedCallback } from '.'
|
2025-04-05 20:52:09 +07:00
|
|
|
import type { Metro } from '#/metro'
|
2025-03-30 23:32:17 +07:00
|
|
|
|
|
|
|
|
export const _all = new Set<ModuleInitializedCallback>()
|
|
|
|
|
export const _specific = new Map<Metro.ModuleID, Set<ModuleInitializedCallback>>()
|
|
|
|
|
export const _importedPath = new Set<ModuleWithImportedPathInitializedCallback>()
|
|
|
|
|
|
2025-04-05 20:52:09 +07:00
|
|
|
export function _executeSubscription(id: Metro.ModuleID, exports: Metro.ModuleExports) {
|
|
|
|
|
for (const cb of _all) cb(id, exports)
|
|
|
|
|
if (_specific.has(id)) for (const cb of _specific.get(id)!) cb(id, exports)
|
2025-03-30 23:32:17 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function _executeImportedPathSubscription(id: Metro.ModuleID, path: string) {
|
|
|
|
|
for (const cb of _importedPath) cb(id, path)
|
|
|
|
|
}
|