[]previous and next page

SlotBranch

A branch a slot shows, or builds during a transition.

A branch a slot shows, or builds during a transition. A branch without dispose is torn down by its memo.

Import#

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

Signature#

ts
interface SlotBranch<C extends SlotChoice> {
  /** The choice the branch was built for. */
  readonly choice: C;
  /** The record its accessors read. */
  readonly owned: SlotOwned;
  /** What the branch produced: the value the slot's output returns while the branch is shown. */
  readonly result: unknown;
  /**
   * Tears the branch down. Set for the branches a transition built: they live under the holder, not
   * under the memo.
   * @default undefined (the slot's memo tears the branch down)
   */
  readonly dispose?: () => void;
  /**
   * The hold a transition built the branch under; null when none of its reads was held.
   * @default undefined (a memo-owned branch has no hold)
   */
  readonly hold?: TransitionHold | null;
}

Members#

Name Type Description
C C extends SlotChoice
choice readonly choice: C The choice the branch was built for.
owned readonly owned: SlotOwned The record its accessors read.
result readonly result: unknown What the branch produced: the value the slot's output returns while the branch is shown.
dispose? readonly dispose?: () => void Tears the branch down. Set for the branches a transition built: they live under the holder, not under the memo.
hold? readonly hold?: TransitionHold | null The hold a transition built the branch under; null when none of its reads was held.