import { _mInitingId } from '../_internal' import type { ModuleInitializedCallback, ModuleRequiredCallback, ModuleWithImportedPathInitializedCallback } from '.' import type { Metro } from '../../../types' export const _reqAll = new Set() export const _reqSpecific = new Map>() export const _initAll = new Set() export const _initSpecific = new Map>() export const _importedPath = new Set() export function _executeRequiredSubscription(id: Metro.ModuleID) { for (const cb of _reqAll) cb(id) if (_reqSpecific.has(id)) { for (const cb of _reqSpecific.get(id)!) cb(id) _reqSpecific.delete(id) } } export function _executeInitializedSubscription(id: Metro.ModuleID, exports: Metro.ModuleExports) { for (const cb of _initAll) cb(id, exports) if (_initSpecific.has(id)) { for (const cb of _initSpecific.get(id)!) cb(id, exports) _initSpecific.delete(id) } } export function _executeImportedPathSubscription(id: Metro.ModuleID, path: string) { for (const cb of _importedPath) cb(id, path) }