Field Notes
    Preparing search index...

    Function useElements

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

      Type Parameters

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

      Parameters

      • type: MaybeRef<T>

      Returns Readonly<ShallowRef<Extract<CanvasElement, { type: T }>[]>>

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

      Parameters

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

      Returns Readonly<ShallowRef<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 Readonly<ShallowRef<R>>