Type Alias: WatcherNotify
API / @xmachines/play-signals / WatcherNotify
type WatcherNotify = () => void;Defined in: packages/play-signals/src/types.ts:141
The notification callback of a Signal.subtle.Watcher
The watcher calls it after a signal that it watches changes. Use the microtask batching pattern to group rapid updates. The README of signal-polyfill gives the best practice.
Returns
void
Example
import { Signal } from "@xmachines/play-signals";
const notify: WatcherNotify = () => { queueMicrotask(() => { const pending = watcher.getPending(); // Process the signal changes that wait });};const watcher = new Signal.subtle.Watcher(notify);