Class ComponentCaller<TData, TProperty, TMethod, TComponentExport>

Type Parameters

  • TData extends DataList
  • TProperty extends PropertyList
  • TMethod extends MethodList
  • TComponentExport

Constructors

Properties

The corresponding Component

Accessors

Methods

  • Create an intersection observer

    Parameters

    • Optional options: {
          initialRatio?: number;
          observeAll?: boolean;
          thresholds?: number[];
      }
      • Optional initialRatio?: number
      • Optional observeAll?: boolean
      • Optional thresholds?: number[]

    Returns IntersectionObserver

  • Group several data update calls

    This method is designed for hinting the backend that some updates should be handled together. However, this is done automatically now, so this method is just for backward compatibilities.

    Parameters

    • callback: (() => void)
        • (): void
        • Returns void

    Returns void

  • Pending all data updates in the callback, and apply updates after callback returns

    This function helps grouping several replaceDataOnPath or spliceArrayDataOnPath calls, and then apply them at the end of the callback. setData and applyDataUpdates calls inside the callback still apply updates immediately.

    Type Parameters

    • T

    Parameters

    • callback: (() => T)
        • (): T
        • Returns T

    Returns undefined | T

  • Schedule a data update on a single specified path

    The data update will not be applied until next setData or applyDataUpdates call. All data observers will not be triggered immediately before applied. Reads of the data will get the unchanged value before applied.

    Type Parameters

    • T extends (string | number)[]

    Parameters

    Returns void

  • Do a classic data update

    The callback is called after the update applies in the backend. In most cases, you SHOULD NOT wait the backend update (that might be very slow), and most calls, including read calls such as selectComponent , simply works immediately. However, when called inside observers, the data update will not be applied to templates immediately (it is recommanded to use updateData instead in observers).

    Parameters

    • newData: Partial<IsAny<DataWithPropertyValues<TData, TProperty>> extends true
          ? Record<`${any}`, DataWithPropertyValues<TData, TProperty>>
          : UnionToIntersection<DataWithPropertyValues<TData, TProperty> extends any[]
              ? {
                  [P in number]: (IsAny<((...) & (...) & (...))[P]> extends true
                      ? Record<SetDataStringPath<any, `${(...)}`>, ((...) & (...) & (...))[P]>
                      : UnionToIntersection<(...)[(...)] extends (...)[]
                          ? (...)[(...)]
                          : (...) extends (...)
                              ? (...)
                              : (...)>) & Record<`${P}`, ((...)[] & TData & PropertyValues<(...)>)[P]>
              }[(keyof any[] | keyof TProperty | keyof TData) & number]
              : DataWithPropertyValues<TData, TProperty> extends Record<string | number, any>
                  ? {
                      [P in string | number]: (IsAny<(...)[(...)]> extends true
                          ? Record<SetDataStringPath<(...), (...)>, (...)[(...)]>
                          : UnionToIntersection<(...) extends (...)
                              ? (...)
                              : (...)>) & Record<`${P}`, DataWithPropertyValues<(...), (...)>[P]>
                  }[(keyof TProperty | keyof TData) & (string | number)]
                  : never>>
    • Optional callback: (() => void)
        • (): void
        • Returns void

    Returns void

  • Schedule an array update

    The behavior is like Array.prototype.slice . Break the array before the index-th item, delete del items, and insert some items here. If index is undefined, negative, or larger than the length of the array, no items will be deleted and new items will be appended to the end of the array. The data update will not be applied until next setData or applyDataUpdates call. All data observers will not be triggered immediately before applied. Reads of the data will get the unchanged value before applied.

    Type Parameters

    • T extends (string | number)[]

    Parameters

    Returns void

  • Trigger an event

    Parameters

    • name: string
    • detail: any
    • options: {
          bubbles?: boolean;
          capturePhase?: boolean;
          composed?: boolean;
      }
      • Optional bubbles?: boolean
      • Optional capturePhase?: boolean
      • Optional composed?: boolean

    Returns void

  • Schedule a classic data updates

    The data update will not be applied until next setData or applyDataUpdates call. When called inside observers, the data update will be applied when observer ends. All data observers will not be triggered immediately before applied. Reads of the data will get the unchanged value before applied.

    Parameters

    Returns void