Private
Public Access
1
0
Files

55 lines
2.4 KiB
TypeScript

/*!
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License.
*/
import * as Types from "../Types";
import { Subscribable } from "./Subscribable";
export declare class ObservedElementAPI extends Subscribable<HTMLElement, Types.ObservedElementDetails> implements Types.ObservedElementAPI {
private _win;
private _tabster;
private _waiting;
private _lastRequestFocusId;
private _observedById;
private _observedByName;
private _currentRequest;
private _currentRequestTimestamp;
onObservedElementChange?: (change: Types.ObservedElementChange) => void;
constructor(tabster: Types.TabsterCore);
dispose(): void;
private _onFocus;
private _rejectWaiting;
private _populateTimeoutDiagnostics;
private _isObservedNamesUpdated;
private _notifyObservedElementChange;
/**
* Returns all registered observed names with their respective elements and full names arrays
*
* @returns Map<string, Array<{ element: HTMLElement; names: string[] }>> A map where keys are observed names
* and values are arrays of objects containing the element and its complete names array (in the order they were defined)
*/
getAllObservedElements(): Map<string, Array<{
element: HTMLElement;
names: string[];
}>>;
/**
* Returns existing element by observed name
*
* @param observedName An observed name
* @param accessibility Optionally, return only if the element is accessible or focusable
* @returns HTMLElement | null
*/
getElement(observedName: string, accessibility?: Types.ObservedElementAccessibility): HTMLElement | null;
/**
* Waits for the element to appear in the DOM and returns it.
*
* @param observedName An observed name
* @param timeout Wait no longer than this timeout
* @param accessibility Optionally, wait for the element to also become accessible or focusable before returning it
* @returns Promise<HTMLElement | null>
*/
waitElement(observedName: string, timeout: number, accessibility?: Types.ObservedElementAccessibility): Types.ObservedElementAsyncRequest<HTMLElement | null>;
requestFocus(observedName: string, timeout: number, options?: Pick<FocusOptions, "preventScroll">): Types.ObservedElementAsyncRequest<boolean>;
onObservedElementUpdate: (element: HTMLElement) => void;
private _waitConditional;
}