Skip to content
pixi-silk
GitHub repository
Entry point

pixi-silk/signal

signal, computed, watch, batch: the small reactive store every widget state uses.

import { batch, computed, signal, watch } from 'pixi-silk/signal';

Interfaces#

InterfaceDescription
ComputedA derived signal. dispose() stops it following its sources.
ReadSignalA value you can read and watch.
SignalA value you can read, watch and change.

Type Aliases#

Type AliasDescription
ListenerCalled with the new and the previous value.

Functions#

FunctionDescription
batchRuns fn and delivers the change notifications once, after it returns, even if it throws. A signal set several times notifies once, with the value from before the batch as previous. It notifies nothing if it ends equal to that value. Batches nest.
computedDerives a signal from others: fn runs now and again whenever one of the sources changes. Only the listed sources are followed. Call dispose() when you no longer need it.
signalCreates a signal. equals decides when a write is a change (default Object.is), so mutating an object in place and setting it again notifies nobody. Set a new object instead.
watchCalls fn now and on every change of source. Returns the unsubscribe function.