import { BiDi } from "../../index"; import WebSocket from "ws"; import Session from "../session/commands"; import { BrowsingContextEventName, EventSubscriptionType } from "./eventTypes"; /** * Handles event subscriptions and processes messages * from a bidirectional browser automation protocol (BiDi) connection. */ export default class BrowsingContextEvents { _ws: BiDi; _connection: WebSocket; _session: Session; eventSubscriptions: Map; /** * Construct a new BrowsingContextEvents instance. * @param {BiDi} BidiConnection The connected BiDi instance */ constructor(BidiConnection: BiDi); /** * Get currently subscribed event data. * @return {Map} The map of current event subscriptions. */ get eventSubscriptionData(): Map; /** * Handles event subscription and message processing for a specific event. * @param {BrowsingContextEventName} eventName - Name of the event to subscribe to. * @return {Promise} * @private */ private handleEvent; /** * Handles BrowsingContextInfo event when a context is created. * @return {Promise} */ contextCreated(): Promise; /** * Handles BrowsingContextInfo event when a context is destroyed. * @return {Promise} */ contextDestroyed(): Promise; /** * Handles BrowsingContextNavigationInfo event when navigation starts. * @return {Promise} */ navigationStarted(): Promise; /** * Handles BrowsingContextNavigationInfo event when fragment navigates. * @return {Promise} */ fragmentNavigated(): Promise; /** * Handles BrowsingContextNavigationInfo event when DOM content is loaded. * @return {Promise} */ domContentLoaded(): Promise; /** * Handles BrowsingContextNavigationInfo event when the page load event happens. * @return {Promise} */ load(): Promise; /** * Handles BrowsingContextNavigationInfo event when download begins. * @return {Promise} */ downloadWillBegin(): Promise; /** * Handles BrowsingContextNavigationInfo event when navigation is aborted. * @return {Promise} */ navigationAborted(): Promise; /** * Handles BrowsingContextNavigationInfo event when navigation fails. * @return {Promise} */ navigationFailed(): Promise; /** * Handles user prompt closed event. * @return {Promise} */ userPromptClosed(): Promise; /** * Handles user prompt opened event. * @return {Promise} */ userPromptOpened(): Promise; }