Themes

Stores/Utils/createStore
createStore

Create a new basic store with the given initial state.

(defaultState: T shouldUpdate?: (newV: any oldValue: any prop: keyofT ) => boolean ) => Store<T>

Store

A basic key value store.

Name
Description
Type
[$data]

internal access to data

Readonly<Map<keyofT, T>>
on

subscribe to events within the store

OnHandler<T>
onChange

Listen for value changes on a specified key.

OnChangeHandler<T>
size

the number of key / value pairs in the store

number
state

Proxied object that will detect dependencies and call the subscriptions and computed properties.

T
delete

remove value for key in store

(key: K ) => boolean
dispose

Resets the state to its original state and signals a dispose event to all the plugins.

() => void
get

Get value for key in store.

(key: K ) => T[K]
has

Check if store has key

(key: K ) => boolean
keys

remove value for key in store

() => IterableIterator<keyofT>
reset

Resets the state to its original state.

() => void
set

set value for key in store

(key: K value: T[K] ) => void
use

Registers a subscription that will be called whenever the user gets, sets, or resets a value.

(plugins: Plugin<T>[]) => () => void

Plugin

Plugin<T extends any> = (store: Store<T> ) => Subscription<T>