Skip to content

@shtse8/fluxus v1.0.0


@shtse8/fluxus / src / StateProviderInstance

Interface: StateProviderInstance()<T>

Defined in: src/providers/stateProvider.ts:49

A specialized Provider that manages a mutable piece of state.

It provides the current state value when read and allows the state to be updated via an updater function obtained from the Scope. StateProviders are the primary way to introduce mutable state into the Fluxus system.

Extends

Type Parameters

T

T

The type of the state value.

StateProviderInstance(reader): T

Defined in: src/providers/stateProvider.ts:49

A specialized Provider that manages a mutable piece of state.

It provides the current state value when read and allows the state to be updated via an updater function obtained from the Scope. StateProviders are the primary way to introduce mutable state into the Fluxus system.

Parameters

reader

ScopeReader

Returns

T

Properties

_fluxus_provider_type

readonly _fluxus_provider_type: "StateProvider"

Defined in: src/providers/stateProvider.ts:65

Internal

A read-only property for easier type narrowing if needed.


[$stateProvider]

[$stateProvider]: object

Defined in: src/providers/stateProvider.ts:51

Internal

A unique symbol used to identify StateProvider instances.

initializeState()

initializeState: (reader, internalId) => StateProviderState<T>

Internal

The function called by the Scope to create the initial state for this provider instance within that scope.

Parameters
reader

ScopeReader

The reader for the initializing scope.

internalId

number

A unique ID assigned by the scope for debugging.

Returns

StateProviderState<T>

The initial internal state.

name?

optional name: string

An optional name for debugging.

Released under the ISC License.