Field Notes
    Preparing search index...

    Function injectElements

    • Elements of one type; a Signal type is followed. Updates on every store mutation.

      Type Parameters

      • T extends "stroke" | "note" | "arrow" | "image" | "html" | "text" | "shape" | "extension"

      Parameters

      • type: T | Signal<T>

      Returns Signal<
          (
              | Extract<StrokeElement, { type: T }>
              | Extract<NoteElement, { type: T }>
              | Extract<ArrowElement, { type: T }>
              | Extract<ImageElement, { type: T }>
              | Extract<HtmlElement, { type: T }>
              | Extract<TextElement, { type: T }>
              | Extract<ShapeElement, { type: T }>
              | Extract<ExtensionElementEnvelope, { type: T }>
          )[],
      >

    • All elements, or those of the type a Signal holds (followed); updates on every store mutation (use a selector for hot paths).

      Parameters

      • Optionaltype:
            | "stroke"
            | "note"
            | "arrow"
            | "image"
            | "html"
            | "text"
            | "shape"
            | "extension"
            | Signal<
                | "stroke"
                | "note"
                | "arrow"
                | "image"
                | "html"
                | "text"
                | "shape"
                | "extension"
                | undefined,
            >

      Returns Signal<CanvasElement[]>

    • Derived value; updates only when the selected value changes (per isEqual, default: one-level shallow compare — arrays by index, plain objects by key, primitives by Object.is). Supply isEqual for deeper structures: selectors returning nested fresh objects still need a custom comparator because the default only compares one level deep.

      Type Parameters

      • R

      Parameters

      • selector: (elements: CanvasElement[]) => R
      • OptionalisEqual: (a: R, b: R) => boolean

      Returns Signal<R>