Reactivity primitives
The kernel’s reactive graph is exported for plugin authors and for use outside the DOM.
import { signal, computed, effect, batch, untracked, onSettled, flush } from 'sigmx'
const n = signal(1)const double = computed(() => n.value * 2)const stop = effect(() => console.log(double.value)) // logs 2batch(() => { n.value = 2; n.value = 3 }) // logs 6 onceuntracked(() => n.value) // read without subscribingn.peek() // same, for one signaln.bump() // notify after mutating an object in placestop()Signal<T>:value(get/set),peek(),bump().Computed<T>: read-onlyvalue, lazily recomputed; its version moves only when the result changes, so downstream effects can skip runs;dispose()unsubscribes it (the store does this when a computed leaf goes).effect(fn, onError?): runs now and on change; effects created inside an effect are disposed when the parent re-runs; returns a disposer.rootEffect(fn, onError?)is the same but never owned by the running effect: use it for long-lived effects created from inside another effect (mounted attributes use it).batch(fn): coalesce writes.onSettled(fn): run after each flush.flush(): run queued effects now.
The graph has no DOM dependency and is tested in Node.