Skip to Content

initialize Method

Initializes the store and all of its items, preparing it for use. Optionally, a beforeInit callback function can be provided, which will be executed before the store is initialized

@param beforeInit?: (store: this) => void
An optional callback function that runs before the store is initialized

@returns this
The current instance of the store, allowing for method chaining

API

initialize(beforeInit?: (store: this) => void): this;

Example

import {state, Store} from '@bitfiber/rx'; class ProductsStore extends Store { products = state<any[]>(); #ready = this.markAsReady(); } const store = new ProductsStore(); // Initializes the store store.initialize();
Last updated on