API Reference

IStateManagerinterface

The contract implemented by StateManager. Defines the full public API for watching, reading, writing, and releasing reactive state — plus the four observable streams (changed, contextChanged, startChangeCycle, endChangeCycle) that the expression runtime and application code subscribe to.

Quick facts
Kind
interface
Members
11
Package
@rs-x/core

Declaration

export interface IStateManager {
  readonly changed: Observable<IStateChange>;
  readonly contextChanged: Observable<IContextChanged>;
  readonly startChangeCycle: Observable<IChangeCycleIndex>;
  readonly endChangeCycle: Observable<IChangeCycleIndex>;
  isWatched(
    context: unknown,
    index: unknown,
    indexWatchRule?: IIndexWatchRule,
  ): boolean;
  watchState(
    context: unknown,
    index: unknown,
    options?: IStateOptions,
  ): unknown;
  subscribeStateEvents(
    context: unknown,
    index: unknown,
    listener: IStateEventListener,
  ): () => void;
  releaseState(
    context: unknown,

Import

import type { IStateManager } from '@rs-x/state-manager';

Members

11 members in this interface.

readonly changed
propertyreadonly
readonly changed: Observable<IStateChange>

Type

Observable<IStateChange>

readonly contextChanged
propertyreadonly
readonly contextChanged: Observable<IContextChanged>

Type

Observable<IContextChanged>

readonly endChangeCycle
propertyreadonly
readonly endChangeCycle: Observable<IChangeCycleIndex>

Type

Observable<IChangeCycleIndex>

readonly startChangeCycle
propertyreadonly
readonly startChangeCycle: Observable<IChangeCycleIndex>

Type

Observable<IChangeCycleIndex>

clear
method
clear(): void

Parameters

No parameters.

Returns

void

getState
method
getState<T>(
  context: unknown,
  index: unknown
): T

Parameters

NameTypeRequired
contextunknownrequired
indexunknownrequired

Returns

T

isWatched
method
isWatched(
  context: unknown,
  index: unknown,
  indexWatchRule?: IIndexWatchRule
): boolean

Parameters

NameTypeRequired
contextunknownrequired
indexunknownrequired
indexWatchRule?IIndexWatchRuleoptional

Returns

boolean

releaseState
method
releaseState(
  context: unknown,
  index: unknown,
  indexWatchRule?: IIndexWatchRule
): void

Parameters

NameTypeRequired
contextunknownrequired
indexunknownrequired
indexWatchRule?IIndexWatchRuleoptional

Returns

void

setState
method
setState<T>(
  context: unknown,
  index: unknown,
  value: T,
  ownerId?: unknown
): void

Parameters

NameTypeRequired
contextunknownrequired
indexunknownrequired
valueTrequired
ownerId?unknownoptional

Returns

void

subscribeStateEvents
method
subscribeStateEvents(
  context: unknown,
  index: unknown,
  listener: IStateEventListener
): () => void

Parameters

NameTypeRequired
contextunknownrequired
indexunknownrequired
listenerIStateEventListenerrequired

Returns

() => void

watchState
method
watchState(
  context: unknown,
  index: unknown,
  options?: IStateOptions
): unknown

Parameters

NameTypeRequired
contextunknownrequired
indexunknownrequired
options?IStateOptionsoptional

Returns

unknown