Skip to content

Latest commit

 

History

History
153 lines (91 loc) · 3.07 KB

File metadata and controls

153 lines (91 loc) · 3.07 KB

Back to README.md

@openmrs/esm-state

Table of contents

Interfaces

Functions

Functions

createGlobalStore

createGlobalStore<TState>(name, initialState): Store<TState>

Creates a Unistore store.

Type parameters

Name
TState

Parameters

Name Type Description
name string A name by which the store can be looked up later. Must be unique across the entire application.
initialState TState An object which will be the initial state of the store.

Returns

Store<TState>

The newly created store.

Defined in

state.ts:18


getAppState

getAppState(): Store<AppState>

Returns

Store<AppState>

The store named app.

Defined in

state.ts:85


getGlobalStore

getGlobalStore<TState>(name, fallbackState?): Store<TState>

Returns the existing store named name, or creates a new store named name if none exists.

Type parameters

Name Type
TState TState = any

Parameters

Name Type Description
name string The name of the store to look up.
fallbackState? TState The initial value of the new store if no store named name exists.

Returns

Store<TState>

The found or newly created store.

Defined in

state.ts:55


subscribeTo

subscribeTo<T, U>(store, select, handle): Unsubscribe

Type parameters

Name
T
U

Parameters

Name Type
store Store<T>
select (state: T) => U
handle (subState: U) => void

Returns

Unsubscribe

Defined in

state.ts:89


update

update<T>(obj, __namedParameters, value): T

Type parameters

Name Type
T T: Record<string, any>

Parameters

Name Type
obj T
__namedParameters string[]
value any

Returns

T

Defined in

update.ts:1