Skip to main content

Class: Atom<T>

Type parameters

NameType
Tany

Hierarchy

Constructors

constructor

new Atom<T>(defaultValue, name?)

Type parameters

NameType
Tany

Parameters

NameType
defaultValueT
name?string

Overrides

Synergy.constructor

Defined in

atom.ts:7

Properties

atoms

Readonly atoms: AtomTuple<[T]>

Inherited from

Synergy.atoms

Defined in

synergy.ts:17


defaultValue

Readonly defaultValue: T


id

Readonly id: symbol

Defined in

atom.ts:5


name

Optional Readonly name: string

Methods

combine

combine<R>(...otherSynergies): Synergy<[T, ...Flatten<R, []>[]]>

Type parameters

NameType
Rextends any[]

Parameters

NameType
...otherSynergiesSynergyTuple<R>

Returns

Synergy<[T, ...Flatten<R, []>[]]>

Inherited from

Synergy.combine

Defined in

synergy.ts:29


createAction

createAction<A>(handler): () => (...args: A) => Promise<void>

Type parameters

NameType
Aextends any[]

Parameters

NameType
handler(...args: A) => (...drafts: DraftTuple<[T]>) => void | Promise<void>

Returns

fn

▸ (): (...args: A) => Promise<void>

Returns

fn

▸ (...args): Promise<void>

Parameters
NameType
...argsA
Returns

Promise<void>

Inherited from

Synergy.createAction

Defined in

synergy.ts:54


createInitialValue

createInitialValue(value): Object

Parameters

NameType
valueT

Returns

Object

Defined in

atom.ts:12


createProviderState

createProviderState(initialState?): Record<symbol, AtomContextData<T>>

internal

Parameters

NameType
initialState?Record<symbol, any>

Returns

Record<symbol, AtomContextData<T>>

Inherited from

Synergy.createProviderState

Defined in

synergy.ts:102


createSelector

createSelector<R>(selectorFn): () => any

Type parameters

Name
R

Parameters

NameType
selectorFn(...args: [T]) => R

Returns

fn

▸ (): any

Returns

any

Inherited from

Synergy.createSelector

Defined in

synergy.ts:37


useSet

useSet(): (...args: [T]) => Promise<void>

Returns

fn

▸ (...args): Promise<void>

Parameters
NameType
...args[T]
Returns

Promise<void>

Inherited from

Synergy.useSet

Defined in

synergy.ts:119


useValue

useValue(): any

Returns

any

Inherited from

Synergy.useValue

Defined in

synergy.ts:115