createMutableStore
Creates a mutable store with named pulse methods.
Table of contents
Category
Value
Import
jsimport { createMutableStore } from "valyrian.js/pulses";Public signature
tscreateMutableStore<StateType extends Record<string, any>, PulsesType extends Record<string, Pulse<StateType, any>>>(initialState: StateType, pulses: PulsesType & ThisType<PulsesType & PulseContext>): StorePulses<PulsesType> & { state: ProxyState<StateType>; on: (event: string, callback: Function) => void; off: (event: string, callback: Function) => void; }API form
createMutableStore is a factory. It returns the same named pulse surface as createPulseStore with publicly mutable state.
Returned surface and restriction
Direct writes to state do not notify rendered subscribers. Named pulse methods retain the normal pulse notification path.
tstype ProxyState<StateType> = StateType & { [key: string]: any };
state: ProxyState<StateType>
...namedPulseMethods
on("pulse", callback): void
off("pulse", callback): void