[]previous and next page

notify

Marks the observers of source stale and schedules a flush.

Marks the observers of source stale and schedules a flush. Call it after changing a source's value in place (for example after mutating an array a signal node holds), where writeSignal cannot see the change.

Import#

ts
import { notify } from "@shadow-js/core/extend";

Signature#

ts
function notify(source: Source): void

Parameters#

Name Description
source A signal or memo node. A source nobody observes is left alone.

Examples#

ts
import { createSignalNode, notify } from "@shadow-js/core/extend";

const list = createSignalNode<string[]>([], false);
list.value.push("milk"); // an in-place change: no equality can see it
notify(list); // the readers of `list` run again