[]previous and next page

schedule

Requests a flush in a microtask: call it after marking observers stale by hand, as markObservers does not.

Requests a flush in a microtask: call it after marking observers stale by hand, as markObservers does not. Does nothing when a microtask flush is already due, inside a batch or group (which flushes or schedules on exit), during a flush (which picks the work up), or during a transition (its effects wait for the lane). An error thrown by that flush has no caller to reach: it goes to the global reportError, or becomes an unhandled promise rejection.

Import#

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

Signature#

ts
function schedule(): void

Examples#

ts
import { markObservers, schedule, type SourceNode } from "@shadow-js/core/extend";

export function touch(source: SourceNode): void {
  markObservers(source);
  schedule(); // the effects that read `source` run in a microtask
}