Public constructor (which should never be called).
A TypeError upon construction.
Overridden function binding the StateEffect to the polymorphic
this
of the StateWorker.
The explicit polymorphic this
parameter.
This StateEffect bound to the StateWorker.
Implanted StateEffect providing convenient access to the state of Stores from within StateWorker.dispatched Store.Actions. This StateEffect in combination with the DispatchEffect can be used to implement complex interactions between different Stores.
The extending Store InstanceType.
The Bus.Handle representing the Store.
The current state of the Store.
Retrieve the state from another Store:
import { type Bus } from '@sgrud/bus';
import { Stateful, Store } from '@sgrud/state';
@Stateful('io.github.sgrud.store.example', { state: undefined })
export class ExampleStore extends Store<ExampleStore> {
public readonly state?: Store.State<Store>;
public async getState(handle: Bus.Handle): Promise<Store.State<this>> {
const state = await sgrud.state.effects.state(handle);
return { ...this, state };
}
}
Generated using TypeDoc
Built-in StateEffect extending the abstract Effect base class. This StateEffect is automatically StateWorker.implanted when the
@sgrud/state
module is imported and can therefore be always used in Store.Actions.Decorator
Implant
See
Effect