Initializes a new instance of the HomElementsComponent class.
The UI tree scope.
The backend client for communication.
The descriptor for UI elements.
The result of subscribing to HomElements.
A descriptor that represents the element of the UI.
If the UI is a window, this will be null.
A descriptor that represents the window to which the UI belongs, or indicates that the UI is a window itself.
Readonly subscriptionStatic Readonly ALLPROPERTYIDGets the count of elements in the collection.
The count of elements.
Gets all HomElements in the collection.
An array of HomElement instances.
Gets the HomElement at the specified index.
The index of the HomElement to retrieve.
The HomElement at the specified index.
Subscribes to changes in the HomElementsComponent's bounding box changes and executes the provided callback.
The callback function to invoke on bounding box changes. The callback receives a object with the updated array of HomElement.
// 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.
Subscribes to element selection events and executes the provided callback.
The callback function to invoke on element selection changes. The callback receives the updated array of HomElement.
// 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.
Subscribes to element toggle state change events and executes the provided callback.
The callback function to invoke on element toggle state changes. The callback receives the updated array of HomElement.
// 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.
function invoke on name changes. The callback receives a object with the updated array of HomElement.
// 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.
The callback function to invoke on text changes. The callback receives the new text content as a string.
// 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
Subscribes to changes in the HomElementsComponent's text selection content and executes the provided callback.
The callback function to invoke on text selection changes. The callback receives the new text content as a string.
// 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.
// 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.
Represents a component responsible for managing a collection of HomElement instances.