Registry
Elf keeps your stores in a registry
and exposes the following functions:
getRegistry
Get the the registry:
import { getRegistry } from '@ngneat/elf';
const stores = getRegistry();
getStore
Get a reference to a store by name:
import { getStore } from '@ngneat/elf';
const todosStore = getStore('name');
getStoresSnapshot
Get a snapshot of stores values:
import { getStoresSnapshot } from '@ngneat/elf';
const storesValues = getStoresSnapshot();
registry$
An observable that emits when a store is added or removed:
import { registry$ } from '@ngneat/elf';
registry$.subscribe(event => {
// event = { type: 'add' | 'remove'; store: Store }
})