UNPKG

substate

Version:

Pub/Sub pattern with State Management

26 lines 888 B
import type { TState } from '../Substate/interfaces'; import { Substate } from '../Substate/Substate'; import type { ISubstateConfig } from '../Substate/Substate.interface'; /** * Creates a new Substate store instance * * @param config - Configuration options for the store * @returns A new Substate store instance * * @example * // Basic usage * const store = createStore({ * state: { count: 0, user: { name: "John" } } * }); * * @example * // With middleware * const store = createStore({ * state: { data: [] }, * beforeUpdate: [(store, action) => console.log("Before:", action)], * afterUpdate: [(store, action) => console.log("After:", action)] * }); */ declare function createStore<TSubstateState extends TState = TState>(config?: ISubstateConfig<TSubstateState>): Substate<TSubstateState>; export { createStore }; //# sourceMappingURL=createStore.d.ts.map