Skip to main content

foundation-store.abstractstore

Home > @genesislcap/foundation-store > AbstractStore

AbstractStore class​

The abstract store that concrete store fragments must extend, which differs from the AbstractStoreRoot.

Signature:

export declare abstract class AbstractStore<TStore extends Store, TEventDetailMap extends EventDetailMap, TInternalEventDetailMap extends EventDetailMap = TEventDetailMap, TStoreRoot extends StoreRoot = StoreRoot> implements Store 

Implements: Store

Constructors​

Constructor

Modifiers

Description

(constructor)(storeFragments)

Constructs a new instance of the AbstractStore class

Properties​

Property

Modifiers

Type

Description

broadcastChannelName

protected

string | null

The broadcast channel name to enable cross-window synchronization. If set, events emitted with { broadcast: true } will be sent to this channel.

commit

protected

readonly

this

(BETA) The value commit proxy.

createAsyncListener

protected

<TDetail = void, TReturn = void>(keys: KeyOrKeys<TEventDetailMap & TInternalEventDetailMap>, token: (detail: TDetail, event?: CustomEvent<TDetail>) => Promise<TReturn>) => EventListener

Creates an async event listener.

createErrorListener

protected

<TDetail extends Error = Error>(keys: KeyOrKeys<TEventDetailMap & TInternalEventDetailMap>, token?: (detail: TDetail, event?: CustomEvent<TDetail>) => void) => EventListener

Creates an error event listener.

createListener

protected

<TDetail = void>(keys: KeyOrKeys<TEventDetailMap & TInternalEventDetailMap>, token: (detail: TDetail, event?: CustomEvent<TDetail>) => void) => EventListener

Creates an event listener.

errors

ErrorMap<TEventDetailMap & TInternalEventDetailMap>

Contains any errors the store may have, see ErrorMap.

name

readonly

string

The name of the store fragment.

root

protected

TStoreRoot

The store root fragment.

Methods​

Method

Modifiers

Description

addStoreFragments(storeFragments)

Lazily add store fragments.

binding(token, subscriberChangeCallback, isVolatileBinding, context)

An api to allow the observation of values and arbitrary bindings outside the template engine.

bindingAsRx()

bindingAsRx(key)

bindingAsRx(getter)

commitValue(key, value)

protected

(BETA) Alternative value commit api.

connect(root)

Connects this store fragment.

disconnect(root)

Disconnects this store fragment.

emit(args)

protected

Emit events to the stores directly via the standard event flow.

invokeAsyncAPI(api, error, success)

protected

A convenience method to invoke an async api and emit success and error events.

removeStoreFragments(storeFragments)

Lazily remove store fragments.