Class StateWorker

The StateWorker is a background Thread which is instantiated by the StateHandler to handle the deployment of Stores and dispatching Store.Actions against them. The same goes for Effects, whose implantation the StateWorker handles.

Decorator

Singleton

See

StateHandler

Constructors

Properties

driver: Driver

Internal Store.Driver employed as backing data storage. This property contains an instance of either the IndexedDB or the SQLite3 class as abstract facade to either storage provider.

Internal Mapping of Store.Effect locates to their corresponding bound Effects.

proxies: WeakMap<object, typeof effects>

Internal WeakMapping of proxyfied references to this StateWorker to the Store.Effects namespace containing Effects bound to this StateWorker.

Internal Mapping of Remote BusWorkers to their corresponding proxy of this StateWorker. This Map is used to keep track of the connected Windows and their respective BusWorkers.

states: Map<Handle, WeakMap<object, States>>

Internal Mapping of Bus.Handles to WeakMapping of Store.States designated by an object reference. This reference either points to the global self reference, if a Store is deployed to be non-transient or, if the opposite applies, to the proxyfied instance of this StateWorker. Through this distinction stores are associated to either a globally shared reference or to a locally contained and transparent Proxy reference to this.

stores: Map<Handle, Store.Type<Store<any>>>

Internal Mapping of deployed Store.Types to their corresponding Bus.Handles.

Methods

  • Public implant method which implants the supplied effect under the supplied locate to the global sgrud.state.effects namespace. When the supplied Effect is already implanted and matches the currently implanted source code, no action is taken. If the effect's sources mismatch, a TypeError is thrown.

    Type Parameters

    Parameters

    Returns Promise<void>

    A Promise resolving upon Store implantation.

    Throws

    A TypeError when the supplied effect mismatches.

    Remarks

    This method should only be invoked by the StateHandler.

Generated using TypeDoc