UNPKG

dreamstate

Version:

Store management library based on react context and observers

24 lines (22 loc) 970 B
/** * Creates a new registry to hold internal stores for the current scope. * * This function returns an `IRegistry` object containing several collections (e.g., `Map`, `Set`) * that are used to store mutable data such as query providers, signal listeners, context instances, * context states, services references, observers, and subscribers within the current scope. * The registry facilitates the management and access of these stores during the application's lifecycle. * * @returns {IRegistry} The newly created registry containing various internal stores used for scope management. */ function createRegistry() { return { QUERY_PROVIDERS_REGISTRY: new Map(), SIGNAL_LISTENERS_REGISTRY: new Set(), CONTEXT_INSTANCES_REGISTRY: new Map(), CONTEXT_STATES_REGISTRY: new Map(), CONTEXT_SERVICES_REFERENCES: new Map(), CONTEXT_OBSERVERS_REGISTRY: new Map(), CONTEXT_SUBSCRIBERS_REGISTRY: new Map() }; } export { createRegistry };