Represents a component responsible for managing a collection of HomElement instances.

Constructors

  • Initializes a new instance of the HomElementsComponent class.

    Parameters

    • uiTreeScope: UITreeScope

      The UI tree scope.

    • backendClient: BackendClient

      The backend client for communication.

    • hostDescriptor: DescriptorDTO
    • elementDescriptor: DescriptorDTO

      The descriptor for UI elements.

    • subscribeHomElementsResult: SubscribeElementsResult

      The result of subscribing to HomElements.

    Returns SubscribedHomElements

Properties

elementDescriptor: DescriptorDTO

A descriptor that represents the element of the UI.
If the UI is a window, this will be null.

hostDescriptor: DescriptorDTO

A descriptor that represents the window to which the UI belongs, or indicates that the UI is a window itself.

subscriptionId: string
ALLPROPERTYID: PropertyId[] = ...

Accessors

  • get elementsCount(): number
  • Gets the count of elements in the collection.

    Returns number

    The count of elements.

Methods

  • Gets all HomElements in the collection.

    Returns HomElement[]

    An array of HomElement instances.

  • Gets the HomElement at the specified index.

    Parameters

    • index: number

      The index of the HomElement to retrieve.

    Returns HomElement

    The HomElement at the specified index.

  • Unsubscribes from bounding box change events.

    Returns Promise<void>

  • Unsubscribes from element selection events.

    Returns Promise<void>

  • Unsubscribes from element toggle state change events.

    Returns Promise<void>

  • Unsubscribes from name change events.

    Returns Promise<void>

  • Unsubscribes from text change events.

    Returns Promise<void>

  • Unsubscribes from text selection change events.

    Returns Promise<void>

  • Unsubscribes from UI change events.

    Returns Promise<void>

  • Subscribes to changes in the HomElementsComponent's bounding box changes and executes the provided callback.

    Parameters

    • callback: ((elements) => void)

      The callback function to invoke on bounding box changes. The callback receives a object with the updated array of HomElement.

        • (elements): void
        • Parameters

          Returns void

    Returns Promise<void>

    Example

    // triggered when the boundingBox of any element in the list is changed. (not including element's children changes)
    // all elements will be returned, including unchanged elements.
    // After the event is triggered, elements will be overwritten with the new value.
    await homElementsComponent.onBoundingBoxChanged((elements) => {
    console.log(elements)
    })

    The following animation demonstrates how onBoundingBoxChanged is triggered whenever the bounding box of any element is changed.

    example

  • Subscribes to element selection events and executes the provided callback.

    Parameters

    • callback: ((elements) => void)

      The callback function to invoke on element selection changes. The callback receives the updated array of HomElement.

        • (elements): void
        • Parameters

          Returns void

    Returns Promise<void>

    Example

    // triggered when any element in the list is selected or deselected.
    // The callback receives the updated HomElement array with isSelected property changes.
    // Only the isSelected property of matching elements will be updated, other elements remain unchanged.
    await homElementsComponent.onElementIsSelectedChanged((elements) => {
    console.log(elements)
    })

    The following animation demonstrates how onElementIsSelectedChanged is triggered whenever any element in the list is selected or deselected.

    example

  • Subscribes to element toggle state change events and executes the provided callback.

    Parameters

    • callback: ((elements) => void)

      The callback function to invoke on element toggle state changes. The callback receives the updated array of HomElement.

        • (elements): void
        • Parameters

          Returns void

    Returns Promise<void>

    Example

    // triggered when any element's toggle state (checked/unchecked, expanded/collapsed, etc.) changes.
    // The callback receives the updated HomElement array with toggleState property changes.
    // Only the toggleState property of matching elements will be updated, other elements remain unchanged.
    await homElementsComponent.onElementToggleStateChanged((elements) => {
    console.log(elements)
    })
  • Subscribes to changes in the HomElementsComponent's name changes and executes the provided callback.

    Parameters

    • callback: ((elements) => void)

      function invoke on name changes. The callback receives a object with the updated array of HomElement.

        • (elements): void
        • Parameters

          Returns void

    Returns Promise<void>

    Example

    // triggered when the name of any element in the list is changed. (not including element's children changes)
    // all elements will be returned, including unchanged elements.
    // After the event is triggered, elements will be overwritten with the new value.
    await homElementsComponent.onNameChanged((elements) => {
    console.log(elements)
    })
  • Subscribes to changes in the HomElementsComponent's text content and executes the provided callback.

    Parameters

    • callback: ((text) => void)

      The callback function to invoke on text changes. The callback receives the new text content as a string.

        • (text): void
        • Parameters

          • text: string

          Returns void

    Returns Promise<void>

    Example

    // triggered when the text content of any element in the list is changed.
    // The callback receives the new text content as a string.
    await homElementsComponent.onTextChanged((text) => {
    console.log('Text changed to:', text)
    })

    The following animation demonstrates how onTextChanged is triggered whenever the text content of any element in the list is changed

    example

  • Subscribes to changes in the HomElementsComponent's text selection content and executes the provided callback.

    Parameters

    • callback: ((text) => void)

      The callback function to invoke on text selection changes. The callback receives the new text content as a string.

        • (text): void
        • Parameters

          • text: string

          Returns void

    Returns Promise<void>

    Example

    // triggered when the text selection content of any element in the visible document is changed.
    // The callback receives the new text content as a string.
    await homElementsComponent.onTextSelectionChanged((text) => {
    console.log('Text changed to:', text)
    })
  • Subscribes to changes in the Elements changes and invokes the provided callback.

    Parameters

    • callback: ((previous, targets) => void)

    Returns Promise<void>

    Example

    // event will be triggered at the following times:
    // - when the children of elements contained in the list change.
    // - when the elements matching the descriptor increase or decrease.
    //
    // After the event is triggered, elements will be overwritten with the new value.
    await homElementsComponent.onUIChange((prevs, targets) => {
    console.log(prevs)
    console.log(targets)
    })
    @param {function(HomElement[], HomElement[]): void} callback - The callback function to invoke on UI changes.