Overview
Watch-factory runtime that provides keyed, reference-counted watch handles and zero-allocation listener dispatch hooks.
API Reference
Reference-counted watch handle with observables and keyed listener registration.
export interface IWatch extends IDisposable {
readonly changed: Observable<IStateChange>;
readonly contextChange: Observable<IContextChanged>;
readonly startChangeCycle: Observable<IChangeCycleIndex>;
readonly endChangeCycle: Observable<IChangeCycleIndex>;
readonly context: unknown;
readonly index: unknown;
readonly value: unknown;
watch(): void;
unwatch(): void;
/** Zero-allocation alternative to subscribing to the four Observables individually. */
addListeners(key: unknown, callbacks: IWatchCallbacks): void;
removeListeners(key: unknown): void;
}import type { IWatch } from '@rs-x/state-manager';10 members in this interface.
readonly changed: Observable<IStateChange>Type
Observable<IStateChange>
readonly context: unknownType
unknown
readonly contextChange: Observable<IContextChanged>Type
Observable<IContextChanged>
readonly endChangeCycle: Observable<IChangeCycleIndex>Type
Observable<IChangeCycleIndex>
readonly index: unknownType
unknown
readonly startChangeCycle: Observable<IChangeCycleIndex>Type
Observable<IChangeCycleIndex>
readonly value: unknownType
unknown
removeListeners(key: unknown): voidParameters
| Name | Type | Required |
|---|---|---|
| key | unknown | required |
Returns
void
unwatch(): voidParameters
No parameters.
Returns
void
watch(): voidParameters
No parameters.
Returns
void