[]previous and next page

TransitionHold

A hold for a value a transition builds while its reads wait for data (a Show branch built during a transition): the reads that wait count against this hold, not against the Suspense boundary around the value, so the shown value stays until the hold settles.

A hold for a value a transition builds while its reads wait for data (a Show branch built during a transition): the reads that wait count against this hold, not against the Suspense boundary around the value, so the shown value stays until the hold settles. Created by createTransitionHold.

Import#

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

Signature#

ts
interface TransitionHold {
  /** Runs `fn` with this hold as the Suspense boundary of the reads inside it. */
  run<T>(fn: () => T): T;
  /** Reads still waiting for data. */
  count(): number;
  /** True once a read in the hold was held (the value is then pending, not ready). */
  engaged(): boolean;
  /** Ends the hold without waking anything (the value is being dropped). */
  drop(): void;
}

Members#

Name Type Description
run run<T>(fn: () => T): T Runs fn with this hold as the Suspense boundary of the reads inside it.
count count(): number Reads still waiting for data.
engaged engaged(): boolean True once a read in the hold was held (the value is then pending, not ready).
drop drop(): void Ends the hold without waking anything (the value is being dropped).