Reference

@reckona/mreact-reactive-core

13 public exports.

Function

Functionbatchfunction batch<T>(fn: (): T): TGroups reactive writes and flushes dependents after the callback returns.FunctionbatchAsyncfunction batchAsync<T>(fn: (): T | Promise<T>): Promise<T>Groups reactive writes across an async callback and flushes after it settles.Functioncellfunction cell<T>(initial: T): Cell<T>Functioncomputedfunction computed<T>(fn: (): T, options?: ComputedOptions<T> | ComputedEquality<T>): ReadonlyCell<T>Creates a lazily evaluated reactive value derived from other cells.Functioneffectfunction effect(fn: (): void | (): void): (): voidRuns a reactive side effect and returns a disposer.Functionselectorfunction selector<TValue, TKey>(source: ReadonlyCell<TValue>, options?: { equals?: SelectorEquality<TValue, TKey> }): Selector<TValue, TKey>Creates keyed boolean cells that update only for the previous and next selected keys.Functionuntrackfunction untrack<T>(fn: (): T): TRuns a callback without recording reactive dependencies.

Interface

InterfaceCellinterface CellMutable reactive value that notifies dependents when changed.InterfaceComputedOptionsinterface ComputedOptionsOptions for creating a computed reactive value.InterfaceReadonlyCellinterface ReadonlyCellReactive value that can be read and tracked as a dependency.InterfaceSelectorinterface SelectorA keyed boolean selector with an explicit disposer for the source subscription.

Type Alias

Type AliasComputedEqualitytype ComputedEquality = (previous: T, next: T): booleanEquality function used to decide whether a computed value changed.Type AliasSelectorEqualitytype SelectorEquality = (value: TValue, key: TKey): booleanEquality function used by selector keys.