diff --git a/docs/api/index.md b/docs/api/index.md index b3aa0bd6..5228d525 100644 --- a/docs/api/index.md +++ b/docs/api/index.md @@ -45,14 +45,14 @@ sidebar_label: API ## Enumerations -| Enumeration | Description | -| ------------------------------------------------------------------------- | --------------------------------------------------------------------- | -| [BrowserContextEmittedEvents](./puppeteer.browsercontextemittedevents.md) | | -| [BrowserEmittedEvents](./puppeteer.browseremittedevents.md) | All the events a [browser instance](./puppeteer.browser.md) may emit. | -| [InterceptResolutionAction](./puppeteer.interceptresolutionaction.md) | | -| [LocatorEmittedEvents](./puppeteer.locatoremittedevents.md) | All the events that a locator instance may emit. | -| [PageEmittedEvents](./puppeteer.pageemittedevents.md) | All the events that a page instance may emit. | -| [TargetType](./puppeteer.targettype.md) | | +| Enumeration | Description | +| --------------------------------------------------------------------- | --------------------------------------------------------------------- | +| [BrowserContextEvent](./puppeteer.browsercontextevent.md) | | +| [BrowserEvent](./puppeteer.browserevent.md) | All the events a [browser instance](./puppeteer.browser.md) may emit. | +| [InterceptResolutionAction](./puppeteer.interceptresolutionaction.md) | | +| [LocatorEvent](./puppeteer.locatorevent.md) | All the events that a locator instance may emit. | +| [PageEvent](./puppeteer.pageevent.md) | All the events that a page instance may emit. | +| [TargetType](./puppeteer.targettype.md) | | ## Functions @@ -65,69 +65,73 @@ sidebar_label: API ## Interfaces -| Interface | Description | -| --------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| [ActionOptions](./puppeteer.actionoptions.md) | | -| [AutofillData](./puppeteer.autofilldata.md) | | -| [BoundingBox](./puppeteer.boundingbox.md) | | -| [BoxModel](./puppeteer.boxmodel.md) | | -| [BrowserConnectOptions](./puppeteer.browserconnectoptions.md) | Generic browser options that can be passed when launching any browser or when connecting to an existing browser instance. | -| [BrowserContextOptions](./puppeteer.browsercontextoptions.md) | BrowserContext options. | -| [BrowserLaunchArgumentOptions](./puppeteer.browserlaunchargumentoptions.md) | Launcher options that only apply to Chrome. | -| [ClickOptions](./puppeteer.clickoptions.md) | | -| [CommonEventEmitter](./puppeteer.commoneventemitter.md) | | -| [Configuration](./puppeteer.configuration.md) |

Defines options to configure Puppeteer's behavior during installation and runtime.

See individual properties for more information.

| -| [ConnectionTransport](./puppeteer.connectiontransport.md) | | -| [ConnectOptions](./puppeteer.connectoptions.md) | | -| [ConsoleMessageLocation](./puppeteer.consolemessagelocation.md) | | -| [ContinueRequestOverrides](./puppeteer.continuerequestoverrides.md) | | -| [CoverageEntry](./puppeteer.coverageentry.md) | The CoverageEntry class represents one entry of the coverage report. | -| [Credentials](./puppeteer.credentials.md) | | -| [CSSCoverageOptions](./puppeteer.csscoverageoptions.md) | Set of configurable options for CSS coverage. | -| [CustomQueryHandler](./puppeteer.customqueryhandler.md) | | -| [Device](./puppeteer.device.md) | | -| [FrameAddScriptTagOptions](./puppeteer.frameaddscripttagoptions.md) | | -| [FrameAddStyleTagOptions](./puppeteer.frameaddstyletagoptions.md) | | -| [FrameWaitForFunctionOptions](./puppeteer.framewaitforfunctionoptions.md) | | -| [GeolocationOptions](./puppeteer.geolocationoptions.md) | | -| [InterceptResolutionState](./puppeteer.interceptresolutionstate.md) | | -| [InternalNetworkConditions](./puppeteer.internalnetworkconditions.md) | | -| [JSCoverageEntry](./puppeteer.jscoverageentry.md) | The CoverageEntry class for JavaScript | -| [JSCoverageOptions](./puppeteer.jscoverageoptions.md) | Set of configurable options for JS coverage. | -| [KeyboardTypeOptions](./puppeteer.keyboardtypeoptions.md) | | -| [KeyDownOptions](./puppeteer.keydownoptions.md) | | -| [LaunchOptions](./puppeteer.launchoptions.md) | Generic launch options that can be passed when launching any browser. | -| [LocatorEventObject](./puppeteer.locatoreventobject.md) | | -| [LocatorOptions](./puppeteer.locatoroptions.md) | | -| [LocatorScrollOptions](./puppeteer.locatorscrolloptions.md) | | -| [MediaFeature](./puppeteer.mediafeature.md) | | -| [Metrics](./puppeteer.metrics.md) | | -| [MouseClickOptions](./puppeteer.mouseclickoptions.md) | | -| [MouseMoveOptions](./puppeteer.mousemoveoptions.md) | | -| [MouseOptions](./puppeteer.mouseoptions.md) | | -| [MouseWheelOptions](./puppeteer.mousewheeloptions.md) | | -| [Moveable](./puppeteer.moveable.md) | | -| [NetworkConditions](./puppeteer.networkconditions.md) | | -| [NewDocumentScriptEvaluation](./puppeteer.newdocumentscriptevaluation.md) | | -| [Offset](./puppeteer.offset.md) | | -| [PageEventObject](./puppeteer.pageeventobject.md) |

Denotes the objects received by callback functions for page events.

See [PageEmittedEvents](./puppeteer.pageemittedevents.md) for more detail on the events and when they are emitted.

| -| [PDFMargin](./puppeteer.pdfmargin.md) | | -| [PDFOptions](./puppeteer.pdfoptions.md) | Valid options to configure PDF generation via [Page.pdf()](./puppeteer.page.pdf.md). | -| [Point](./puppeteer.point.md) | | -| [PuppeteerErrors](./puppeteer.puppeteererrors.md) | | -| [PuppeteerLaunchOptions](./puppeteer.puppeteerlaunchoptions.md) | | -| [RemoteAddress](./puppeteer.remoteaddress.md) | | -| [ResponseForRequest](./puppeteer.responseforrequest.md) | Required response data to fulfill a request with. | -| [ScreenshotClip](./puppeteer.screenshotclip.md) | | -| [ScreenshotOptions](./puppeteer.screenshotoptions.md) | | -| [SerializedAXNode](./puppeteer.serializedaxnode.md) | Represents a Node and the properties of it that are relevant to Accessibility. | -| [SnapshotOptions](./puppeteer.snapshotoptions.md) | | -| [TracingOptions](./puppeteer.tracingoptions.md) | | -| [Viewport](./puppeteer.viewport.md) | Sets the viewport of the page. | -| [WaitForOptions](./puppeteer.waitforoptions.md) | | -| [WaitForSelectorOptions](./puppeteer.waitforselectoroptions.md) | | -| [WaitForTargetOptions](./puppeteer.waitfortargetoptions.md) | | -| [WaitTimeoutOptions](./puppeteer.waittimeoutoptions.md) | | +| Interface | Description | +| --------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| [ActionOptions](./puppeteer.actionoptions.md) | | +| [AutofillData](./puppeteer.autofilldata.md) | | +| [BoundingBox](./puppeteer.boundingbox.md) | | +| [BoxModel](./puppeteer.boxmodel.md) | | +| [BrowserConnectOptions](./puppeteer.browserconnectoptions.md) | Generic browser options that can be passed when launching any browser or when connecting to an existing browser instance. | +| [BrowserContextEvents](./puppeteer.browsercontextevents.md) | | +| [BrowserContextOptions](./puppeteer.browsercontextoptions.md) | BrowserContext options. | +| [BrowserEvents](./puppeteer.browserevents.md) | | +| [BrowserLaunchArgumentOptions](./puppeteer.browserlaunchargumentoptions.md) | Launcher options that only apply to Chrome. | +| [CDPSessionEvents](./puppeteer.cdpsessionevents.md) | | +| [ClickOptions](./puppeteer.clickoptions.md) | | +| [CommonEventEmitter](./puppeteer.commoneventemitter.md) | | +| [Configuration](./puppeteer.configuration.md) |

Defines options to configure Puppeteer's behavior during installation and runtime.

See individual properties for more information.

| +| [ConnectionTransport](./puppeteer.connectiontransport.md) | | +| [ConnectOptions](./puppeteer.connectoptions.md) | | +| [ConsoleMessageLocation](./puppeteer.consolemessagelocation.md) | | +| [ContinueRequestOverrides](./puppeteer.continuerequestoverrides.md) | | +| [CoverageEntry](./puppeteer.coverageentry.md) | The CoverageEntry class represents one entry of the coverage report. | +| [Credentials](./puppeteer.credentials.md) | | +| [CSSCoverageOptions](./puppeteer.csscoverageoptions.md) | Set of configurable options for CSS coverage. | +| [CustomQueryHandler](./puppeteer.customqueryhandler.md) | | +| [Device](./puppeteer.device.md) | | +| [FrameAddScriptTagOptions](./puppeteer.frameaddscripttagoptions.md) | | +| [FrameAddStyleTagOptions](./puppeteer.frameaddstyletagoptions.md) | | +| [FrameEvents](./puppeteer.frameevents.md) | | +| [FrameWaitForFunctionOptions](./puppeteer.framewaitforfunctionoptions.md) | | +| [GeolocationOptions](./puppeteer.geolocationoptions.md) | | +| [InterceptResolutionState](./puppeteer.interceptresolutionstate.md) | | +| [InternalNetworkConditions](./puppeteer.internalnetworkconditions.md) | | +| [JSCoverageEntry](./puppeteer.jscoverageentry.md) | The CoverageEntry class for JavaScript | +| [JSCoverageOptions](./puppeteer.jscoverageoptions.md) | Set of configurable options for JS coverage. | +| [KeyboardTypeOptions](./puppeteer.keyboardtypeoptions.md) | | +| [KeyDownOptions](./puppeteer.keydownoptions.md) | | +| [LaunchOptions](./puppeteer.launchoptions.md) | Generic launch options that can be passed when launching any browser. | +| [LocatorEvents](./puppeteer.locatorevents.md) | | +| [LocatorOptions](./puppeteer.locatoroptions.md) | | +| [LocatorScrollOptions](./puppeteer.locatorscrolloptions.md) | | +| [MediaFeature](./puppeteer.mediafeature.md) | | +| [Metrics](./puppeteer.metrics.md) | | +| [MouseClickOptions](./puppeteer.mouseclickoptions.md) | | +| [MouseMoveOptions](./puppeteer.mousemoveoptions.md) | | +| [MouseOptions](./puppeteer.mouseoptions.md) | | +| [MouseWheelOptions](./puppeteer.mousewheeloptions.md) | | +| [Moveable](./puppeteer.moveable.md) | | +| [NetworkConditions](./puppeteer.networkconditions.md) | | +| [NewDocumentScriptEvaluation](./puppeteer.newdocumentscriptevaluation.md) | | +| [Offset](./puppeteer.offset.md) | | +| [PageEvents](./puppeteer.pageevents.md) |

Denotes the objects received by callback functions for page events.

See [PageEvent](./puppeteer.pageevent.md) for more detail on the events and when they are emitted.

| +| [PDFMargin](./puppeteer.pdfmargin.md) | | +| [PDFOptions](./puppeteer.pdfoptions.md) | Valid options to configure PDF generation via [Page.pdf()](./puppeteer.page.pdf.md). | +| [Point](./puppeteer.point.md) | | +| [PuppeteerErrors](./puppeteer.puppeteererrors.md) | | +| [PuppeteerLaunchOptions](./puppeteer.puppeteerlaunchoptions.md) | | +| [RemoteAddress](./puppeteer.remoteaddress.md) | | +| [ResponseForRequest](./puppeteer.responseforrequest.md) | Required response data to fulfill a request with. | +| [ScreenshotClip](./puppeteer.screenshotclip.md) | | +| [ScreenshotOptions](./puppeteer.screenshotoptions.md) | | +| [SerializedAXNode](./puppeteer.serializedaxnode.md) | Represents a Node and the properties of it that are relevant to Accessibility. | +| [SnapshotOptions](./puppeteer.snapshotoptions.md) | | +| [TracingOptions](./puppeteer.tracingoptions.md) | | +| [Viewport](./puppeteer.viewport.md) | Sets the viewport of the page. | +| [WaitForOptions](./puppeteer.waitforoptions.md) | | +| [WaitForSelectorOptions](./puppeteer.waitforselectoroptions.md) | | +| [WaitForTargetOptions](./puppeteer.waitfortargetoptions.md) | | +| [WaitTimeoutOptions](./puppeteer.waittimeoutoptions.md) | | ## Variables @@ -155,13 +159,14 @@ sidebar_label: API | [Awaitable](./puppeteer.awaitable.md) | | | [AwaitableIterable](./puppeteer.awaitableiterable.md) | | | [AwaitedLocator](./puppeteer.awaitedlocator.md) | | +| [CDPEvents](./puppeteer.cdpevents.md) | | | [ChromeReleaseChannel](./puppeteer.chromereleasechannel.md) | | | [ConsoleMessageType](./puppeteer.consolemessagetype.md) | The supported types for console messages. | | [ElementFor](./puppeteer.elementfor.md) | | | [ErrorCode](./puppeteer.errorcode.md) | | | [EvaluateFunc](./puppeteer.evaluatefunc.md) | | | [EvaluateFuncWith](./puppeteer.evaluatefuncwith.md) | | -| [EventType](./puppeteer.eventtype.md) | | +| [EventsWithWildcard](./puppeteer.eventswithwildcard.md) | | | [ExperimentsConfiguration](./puppeteer.experimentsconfiguration.md) |

Defines experiment options for Puppeteer.

See individual properties for more information.

| | [FlattenHandle](./puppeteer.flattenhandle.md) | | | [HandleFor](./puppeteer.handlefor.md) | | diff --git a/docs/api/puppeteer.browser.md b/docs/api/puppeteer.browser.md index 634c6217..49a045bf 100644 --- a/docs/api/puppeteer.browser.md +++ b/docs/api/puppeteer.browser.md @@ -9,16 +9,16 @@ A Browser is created when Puppeteer connects to a browser instance, either throu #### Signature: ```typescript -export declare class Browser extends EventEmitter implements AsyncDisposable, Disposable +export declare class Browser extends EventEmitter implements AsyncDisposable, Disposable ``` -**Extends:** [EventEmitter](./puppeteer.eventemitter.md) +**Extends:** [EventEmitter](./puppeteer.eventemitter.md)<[BrowserEvents](./puppeteer.browserevents.md)> **Implements:** AsyncDisposable, Disposable ## Remarks -The Browser class extends from Puppeteer's [EventEmitter](./puppeteer.eventemitter.md) class and will emit various events which are documented in the [BrowserEmittedEvents](./puppeteer.browseremittedevents.md) enum. +The Browser class extends from Puppeteer's [EventEmitter](./puppeteer.eventemitter.md) class and will emit various events which are documented in the [BrowserEvent](./puppeteer.browserevent.md) enum. The constructor for this class is marked as internal. Third-party code should not call the constructor directly or create subclasses that extend the `Browser` class. diff --git a/docs/api/puppeteer.browsercontext.md b/docs/api/puppeteer.browsercontext.md index 4443ba28..9f9dd4bc 100644 --- a/docs/api/puppeteer.browsercontext.md +++ b/docs/api/puppeteer.browsercontext.md @@ -9,14 +9,14 @@ BrowserContexts provide a way to operate multiple independent browser sessions. #### Signature: ```typescript -export declare class BrowserContext extends EventEmitter +export declare class BrowserContext extends EventEmitter ``` -**Extends:** [EventEmitter](./puppeteer.eventemitter.md) +**Extends:** [EventEmitter](./puppeteer.eventemitter.md)<[BrowserContextEvents](./puppeteer.browsercontextevents.md)> ## Remarks -The Browser class extends from Puppeteer's [EventEmitter](./puppeteer.eventemitter.md) class and will emit various events which are documented in the [BrowserContextEmittedEvents](./puppeteer.browsercontextemittedevents.md) enum. +The Browser class extends from Puppeteer's [EventEmitter](./puppeteer.eventemitter.md) class and will emit various events which are documented in the [BrowserContextEvents](./puppeteer.browsercontextevents.md) enum. If a page opens another page, e.g. with a `window.open` call, the popup will belong to the parent page's browser context. diff --git a/docs/api/puppeteer.browsercontextemittedevents.md b/docs/api/puppeteer.browsercontextevent.md similarity index 93% rename from docs/api/puppeteer.browsercontextemittedevents.md rename to docs/api/puppeteer.browsercontextevent.md index c395fd3f..94dbed0c 100644 --- a/docs/api/puppeteer.browsercontextemittedevents.md +++ b/docs/api/puppeteer.browsercontextevent.md @@ -1,13 +1,13 @@ --- -sidebar_label: BrowserContextEmittedEvents +sidebar_label: BrowserContextEvent --- -# BrowserContextEmittedEvents enum +# BrowserContextEvent enum #### Signature: ```typescript -export declare const enum BrowserContextEmittedEvents +export declare const enum BrowserContextEvent ``` ## Enumeration Members diff --git a/docs/api/puppeteer.browsercontextevents.md b/docs/api/puppeteer.browsercontextevents.md new file mode 100644 index 00000000..92dee37e --- /dev/null +++ b/docs/api/puppeteer.browsercontextevents.md @@ -0,0 +1,21 @@ +--- +sidebar_label: BrowserContextEvents +--- + +# BrowserContextEvents interface + +#### Signature: + +```typescript +export interface BrowserContextEvents extends Record +``` + +**Extends:** Record<EventType, unknown> + +## Properties + +| Property | Modifiers | Type | Description | Default | +| --------------- | --------- | ------------------------------- | ----------- | ------- | +| targetchanged | | [Target](./puppeteer.target.md) | | | +| targetcreated | | [Target](./puppeteer.target.md) | | | +| targetdestroyed | | [Target](./puppeteer.target.md) | | | diff --git a/docs/api/puppeteer.browseremittedevents.md b/docs/api/puppeteer.browserevent.md similarity index 95% rename from docs/api/puppeteer.browseremittedevents.md rename to docs/api/puppeteer.browserevent.md index e1c1eedf..8f4d7c55 100644 --- a/docs/api/puppeteer.browseremittedevents.md +++ b/docs/api/puppeteer.browserevent.md @@ -1,15 +1,15 @@ --- -sidebar_label: BrowserEmittedEvents +sidebar_label: BrowserEvent --- -# BrowserEmittedEvents enum +# BrowserEvent enum All the events a [browser instance](./puppeteer.browser.md) may emit. #### Signature: ```typescript -export declare const enum BrowserEmittedEvents +export declare const enum BrowserEvent ``` ## Enumeration Members diff --git a/docs/api/puppeteer.browserevents.md b/docs/api/puppeteer.browserevents.md new file mode 100644 index 00000000..e1789dfe --- /dev/null +++ b/docs/api/puppeteer.browserevents.md @@ -0,0 +1,22 @@ +--- +sidebar_label: BrowserEvents +--- + +# BrowserEvents interface + +#### Signature: + +```typescript +export interface BrowserEvents extends Record +``` + +**Extends:** Record<EventType, unknown> + +## Properties + +| Property | Modifiers | Type | Description | Default | +| --------------- | --------- | ------------------------------- | ----------- | ------- | +| disconnected | | undefined | | | +| targetchanged | | [Target](./puppeteer.target.md) | | | +| targetcreated | | [Target](./puppeteer.target.md) | | | +| targetdestroyed | | [Target](./puppeteer.target.md) | | | diff --git a/docs/api/puppeteer.cdpevents.md b/docs/api/puppeteer.cdpevents.md new file mode 100644 index 00000000..06df1610 --- /dev/null +++ b/docs/api/puppeteer.cdpevents.md @@ -0,0 +1,13 @@ +--- +sidebar_label: CDPEvents +--- + +# CDPEvents type + +#### Signature: + +```typescript +export type CDPEvents = { + [Property in keyof ProtocolMapping.Events]: ProtocolMapping.Events[Property][0]; +}; +``` diff --git a/docs/api/puppeteer.cdpsession.md b/docs/api/puppeteer.cdpsession.md index 66d08645..7a8a4ade 100644 --- a/docs/api/puppeteer.cdpsession.md +++ b/docs/api/puppeteer.cdpsession.md @@ -9,10 +9,10 @@ The `CDPSession` instances are used to talk raw Chrome Devtools Protocol. #### Signature: ```typescript -export declare class CDPSession extends EventEmitter +export declare abstract class CDPSession extends EventEmitter ``` -**Extends:** [EventEmitter](./puppeteer.eventemitter.md) +**Extends:** [EventEmitter](./puppeteer.eventemitter.md)<[CDPSessionEvents](./puppeteer.cdpsessionevents.md)> ## Remarks diff --git a/docs/api/puppeteer.cdpsessionevents.md b/docs/api/puppeteer.cdpsessionevents.md new file mode 100644 index 00000000..d7365a4d --- /dev/null +++ b/docs/api/puppeteer.cdpsessionevents.md @@ -0,0 +1,13 @@ +--- +sidebar_label: CDPSessionEvents +--- + +# CDPSessionEvents interface + +#### Signature: + +```typescript +export interface CDPSessionEvents extends CDPEvents, Record +``` + +**Extends:** [CDPEvents](./puppeteer.cdpevents.md), Record<EventType, unknown> diff --git a/docs/api/puppeteer.commoneventemitter.addlistener.md b/docs/api/puppeteer.commoneventemitter.addlistener.md index 7e2655b7..99a8a744 100644 --- a/docs/api/puppeteer.commoneventemitter.addlistener.md +++ b/docs/api/puppeteer.commoneventemitter.addlistener.md @@ -8,16 +8,19 @@ sidebar_label: CommonEventEmitter.addListener ```typescript interface CommonEventEmitter { - addListener(event: EventType, handler: Handler): this; + addListener( + type: Key, + handler: Handler + ): this; } ``` ## Parameters -| Parameter | Type | Description | -| --------- | ------------------------------------- | ----------- | -| event | [EventType](./puppeteer.eventtype.md) | | -| handler | [Handler](./puppeteer.handler.md) | | +| Parameter | Type | Description | +| --------- | ------------------------------------------------------ | ----------- | +| type | Key | | +| handler | [Handler](./puppeteer.handler.md)<Events\[Key\]> | | **Returns:** diff --git a/docs/api/puppeteer.commoneventemitter.emit.md b/docs/api/puppeteer.commoneventemitter.emit.md index 360c130e..ce2fef90 100644 --- a/docs/api/puppeteer.commoneventemitter.emit.md +++ b/docs/api/puppeteer.commoneventemitter.emit.md @@ -8,16 +8,16 @@ sidebar_label: CommonEventEmitter.emit ```typescript interface CommonEventEmitter { - emit(event: EventType, eventData?: unknown): boolean; + emit(type: Key, event: Events[Key]): boolean; } ``` ## Parameters -| Parameter | Type | Description | -| --------- | ------------------------------------- | ------------ | -| event | [EventType](./puppeteer.eventtype.md) | | -| eventData | unknown | _(Optional)_ | +| Parameter | Type | Description | +| --------- | ------------- | ----------- | +| type | Key | | +| event | Events\[Key\] | | **Returns:** diff --git a/docs/api/puppeteer.commoneventemitter.listenercount.md b/docs/api/puppeteer.commoneventemitter.listenercount.md index bed60848..36f549fe 100644 --- a/docs/api/puppeteer.commoneventemitter.listenercount.md +++ b/docs/api/puppeteer.commoneventemitter.listenercount.md @@ -8,15 +8,15 @@ sidebar_label: CommonEventEmitter.listenerCount ```typescript interface CommonEventEmitter { - listenerCount(event: string): number; + listenerCount(event: keyof Events): number; } ``` ## Parameters -| Parameter | Type | Description | -| --------- | ------ | ----------- | -| event | string | | +| Parameter | Type | Description | +| --------- | ------------ | ----------- | +| event | keyof Events | | **Returns:** diff --git a/docs/api/puppeteer.commoneventemitter.md b/docs/api/puppeteer.commoneventemitter.md index 1dca7614..d117efeb 100644 --- a/docs/api/puppeteer.commoneventemitter.md +++ b/docs/api/puppeteer.commoneventemitter.md @@ -7,18 +7,18 @@ sidebar_label: CommonEventEmitter #### Signature: ```typescript -export interface CommonEventEmitter +export interface CommonEventEmitter> ``` ## Methods -| Method | Description | -| ---------------------------------------------------------------------------------- | ----------- | -| [addListener(event, handler)](./puppeteer.commoneventemitter.addlistener.md) | | -| [emit(event, eventData)](./puppeteer.commoneventemitter.emit.md) | | -| [listenerCount(event)](./puppeteer.commoneventemitter.listenercount.md) | | -| [off(event, handler)](./puppeteer.commoneventemitter.off.md) | | -| [on(event, handler)](./puppeteer.commoneventemitter.on.md) | | -| [once(event, handler)](./puppeteer.commoneventemitter.once.md) | | -| [removeAllListeners(event)](./puppeteer.commoneventemitter.removealllisteners.md) | | -| [removeListener(event, handler)](./puppeteer.commoneventemitter.removelistener.md) | | +| Method | Description | +| --------------------------------------------------------------------------------- | ----------- | +| [addListener(type, handler)](./puppeteer.commoneventemitter.addlistener.md) | | +| [emit(type, event)](./puppeteer.commoneventemitter.emit.md) | | +| [listenerCount(event)](./puppeteer.commoneventemitter.listenercount.md) | | +| [off(type, handler)](./puppeteer.commoneventemitter.off.md) | | +| [on(type, handler)](./puppeteer.commoneventemitter.on.md) | | +| [once(type, handler)](./puppeteer.commoneventemitter.once.md) | | +| [removeAllListeners(event)](./puppeteer.commoneventemitter.removealllisteners.md) | | +| [removeListener(type, handler)](./puppeteer.commoneventemitter.removelistener.md) | | diff --git a/docs/api/puppeteer.commoneventemitter.off.md b/docs/api/puppeteer.commoneventemitter.off.md index 75b80adb..97fc8960 100644 --- a/docs/api/puppeteer.commoneventemitter.off.md +++ b/docs/api/puppeteer.commoneventemitter.off.md @@ -8,16 +8,19 @@ sidebar_label: CommonEventEmitter.off ```typescript interface CommonEventEmitter { - off(event: EventType, handler: Handler): this; + off( + type: Key, + handler?: Handler + ): this; } ``` ## Parameters -| Parameter | Type | Description | -| --------- | ------------------------------------- | ----------- | -| event | [EventType](./puppeteer.eventtype.md) | | -| handler | [Handler](./puppeteer.handler.md) | | +| Parameter | Type | Description | +| --------- | ------------------------------------------------------ | ------------ | +| type | Key | | +| handler | [Handler](./puppeteer.handler.md)<Events\[Key\]> | _(Optional)_ | **Returns:** diff --git a/docs/api/puppeteer.commoneventemitter.on.md b/docs/api/puppeteer.commoneventemitter.on.md index 2c257f84..5bb0fb6c 100644 --- a/docs/api/puppeteer.commoneventemitter.on.md +++ b/docs/api/puppeteer.commoneventemitter.on.md @@ -8,16 +8,16 @@ sidebar_label: CommonEventEmitter.on ```typescript interface CommonEventEmitter { - on(event: EventType, handler: Handler): this; + on(type: Key, handler: Handler): this; } ``` ## Parameters -| Parameter | Type | Description | -| --------- | ------------------------------------- | ----------- | -| event | [EventType](./puppeteer.eventtype.md) | | -| handler | [Handler](./puppeteer.handler.md) | | +| Parameter | Type | Description | +| --------- | ------------------------------------------------------ | ----------- | +| type | Key | | +| handler | [Handler](./puppeteer.handler.md)<Events\[Key\]> | | **Returns:** diff --git a/docs/api/puppeteer.commoneventemitter.once.md b/docs/api/puppeteer.commoneventemitter.once.md index 73355af6..f7cae647 100644 --- a/docs/api/puppeteer.commoneventemitter.once.md +++ b/docs/api/puppeteer.commoneventemitter.once.md @@ -8,16 +8,19 @@ sidebar_label: CommonEventEmitter.once ```typescript interface CommonEventEmitter { - once(event: EventType, handler: Handler): this; + once( + type: Key, + handler: Handler + ): this; } ``` ## Parameters -| Parameter | Type | Description | -| --------- | ------------------------------------- | ----------- | -| event | [EventType](./puppeteer.eventtype.md) | | -| handler | [Handler](./puppeteer.handler.md) | | +| Parameter | Type | Description | +| --------- | ------------------------------------------------------ | ----------- | +| type | Key | | +| handler | [Handler](./puppeteer.handler.md)<Events\[Key\]> | | **Returns:** diff --git a/docs/api/puppeteer.commoneventemitter.removealllisteners.md b/docs/api/puppeteer.commoneventemitter.removealllisteners.md index 83b4cd7f..7933a05d 100644 --- a/docs/api/puppeteer.commoneventemitter.removealllisteners.md +++ b/docs/api/puppeteer.commoneventemitter.removealllisteners.md @@ -8,15 +8,15 @@ sidebar_label: CommonEventEmitter.removeAllListeners ```typescript interface CommonEventEmitter { - removeAllListeners(event?: EventType): this; + removeAllListeners(event?: keyof Events): this; } ``` ## Parameters -| Parameter | Type | Description | -| --------- | ------------------------------------- | ------------ | -| event | [EventType](./puppeteer.eventtype.md) | _(Optional)_ | +| Parameter | Type | Description | +| --------- | ------------ | ------------ | +| event | keyof Events | _(Optional)_ | **Returns:** diff --git a/docs/api/puppeteer.commoneventemitter.removelistener.md b/docs/api/puppeteer.commoneventemitter.removelistener.md index 04ff12df..fbe04a68 100644 --- a/docs/api/puppeteer.commoneventemitter.removelistener.md +++ b/docs/api/puppeteer.commoneventemitter.removelistener.md @@ -8,16 +8,19 @@ sidebar_label: CommonEventEmitter.removeListener ```typescript interface CommonEventEmitter { - removeListener(event: EventType, handler: Handler): this; + removeListener( + type: Key, + handler: Handler + ): this; } ``` ## Parameters -| Parameter | Type | Description | -| --------- | ------------------------------------- | ----------- | -| event | [EventType](./puppeteer.eventtype.md) | | -| handler | [Handler](./puppeteer.handler.md) | | +| Parameter | Type | Description | +| --------- | ------------------------------------------------------ | ----------- | +| type | Key | | +| handler | [Handler](./puppeteer.handler.md)<Events\[Key\]> | | **Returns:** diff --git a/docs/api/puppeteer.connection.md b/docs/api/puppeteer.connection.md index 3c16caca..e6075c76 100644 --- a/docs/api/puppeteer.connection.md +++ b/docs/api/puppeteer.connection.md @@ -7,10 +7,10 @@ sidebar_label: Connection #### Signature: ```typescript -export declare class Connection extends EventEmitter +export declare class Connection extends EventEmitter ``` -**Extends:** [EventEmitter](./puppeteer.eventemitter.md) +**Extends:** [EventEmitter](./puppeteer.eventemitter.md)<[CDPSessionEvents](./puppeteer.cdpsessionevents.md)> ## Constructors diff --git a/docs/api/puppeteer.eventemitter.addlistener.md b/docs/api/puppeteer.eventemitter.addlistener.md index 1a53701c..d653ac50 100644 --- a/docs/api/puppeteer.eventemitter.addlistener.md +++ b/docs/api/puppeteer.eventemitter.addlistener.md @@ -14,16 +14,19 @@ Add an event listener. ```typescript class EventEmitter { - addListener(event: EventType, handler: Handler): this; + addListener>( + type: Key, + handler: Handler[Key]> + ): this; } ``` ## Parameters -| Parameter | Type | Description | -| --------- | -------------------------------------------- | ----------- | -| event | [EventType](./puppeteer.eventtype.md) | | -| handler | [Handler](./puppeteer.handler.md)<any> | | +| Parameter | Type | Description | +| --------- | --------------------------------------------------------------------------------------------------------------------- | ----------- | +| type | Key | | +| handler | [Handler](./puppeteer.handler.md)<[EventsWithWildcard](./puppeteer.eventswithwildcard.md)<Events>\[Key\]> | | **Returns:** diff --git a/docs/api/puppeteer.eventemitter.emit.md b/docs/api/puppeteer.eventemitter.emit.md index 085e7b96..460b3503 100644 --- a/docs/api/puppeteer.eventemitter.emit.md +++ b/docs/api/puppeteer.eventemitter.emit.md @@ -10,16 +10,19 @@ Emit an event and call any associated listeners. ```typescript class EventEmitter { - emit(event: EventType, eventData?: unknown): boolean; + emit>( + type: Key, + event: EventsWithWildcard[Key] + ): boolean; } ``` ## Parameters -| Parameter | Type | Description | -| --------- | ------------------------------------- | ------------------------------------------------------- | -| event | [EventType](./puppeteer.eventtype.md) | the event you'd like to emit | -| eventData | unknown | _(Optional)_ any data you'd like to emit with the event | +| Parameter | Type | Description | +| --------- | ---------------------------------------------------------------------------- | ---------------------------- | +| type | Key | the event you'd like to emit | +| event | [EventsWithWildcard](./puppeteer.eventswithwildcard.md)<Events>\[Key\] | | **Returns:** diff --git a/docs/api/puppeteer.eventemitter.listenercount.md b/docs/api/puppeteer.eventemitter.listenercount.md index e1c57d37..279aa581 100644 --- a/docs/api/puppeteer.eventemitter.listenercount.md +++ b/docs/api/puppeteer.eventemitter.listenercount.md @@ -10,15 +10,15 @@ Gets the number of listeners for a given event. ```typescript class EventEmitter { - listenerCount(event: EventType): number; + listenerCount(type: keyof EventsWithWildcard): number; } ``` ## Parameters -| Parameter | Type | Description | -| --------- | ------------------------------------- | --------------------------------------- | -| event | [EventType](./puppeteer.eventtype.md) | the event to get the listener count for | +| Parameter | Type | Description | +| --------- | --------------------------------------------------------------------------- | --------------------------------------- | +| type | keyof [EventsWithWildcard](./puppeteer.eventswithwildcard.md)<Events> | the event to get the listener count for | **Returns:** diff --git a/docs/api/puppeteer.eventemitter.md b/docs/api/puppeteer.eventemitter.md index f70298fb..1a3865ba 100644 --- a/docs/api/puppeteer.eventemitter.md +++ b/docs/api/puppeteer.eventemitter.md @@ -9,10 +9,10 @@ The EventEmitter class that many Puppeteer classes extend. #### Signature: ```typescript -export declare class EventEmitter implements CommonEventEmitter +export declare class EventEmitter> implements CommonEventEmitter> ``` -**Implements:** [CommonEventEmitter](./puppeteer.commoneventemitter.md) +**Implements:** [CommonEventEmitter](./puppeteer.commoneventemitter.md)<[EventsWithWildcard](./puppeteer.eventswithwildcard.md)<Events>> ## Remarks @@ -22,13 +22,13 @@ The constructor for this class is marked as internal. Third-party code should no ## Methods -| Method | Modifiers | Description | -| ---------------------------------------------------------------------------- | --------- | ------------------------------------------------------------------------------------------------ | -| [addListener(event, handler)](./puppeteer.eventemitter.addlistener.md) | | Add an event listener. | -| [emit(event, eventData)](./puppeteer.eventemitter.emit.md) | | Emit an event and call any associated listeners. | -| [listenerCount(event)](./puppeteer.eventemitter.listenercount.md) | | Gets the number of listeners for a given event. | -| [off(event, handler)](./puppeteer.eventemitter.off.md) | | Remove an event listener from firing. | -| [on(event, handler)](./puppeteer.eventemitter.on.md) | | Bind an event listener to fire when an event occurs. | -| [once(event, handler)](./puppeteer.eventemitter.once.md) | | Like on but the listener will only be fired once and then it will be removed. | -| [removeAllListeners(event)](./puppeteer.eventemitter.removealllisteners.md) | | Removes all listeners. If given an event argument, it will remove only listeners for that event. | -| [removeListener(event, handler)](./puppeteer.eventemitter.removelistener.md) | | Remove an event listener. | +| Method | Modifiers | Description | +| --------------------------------------------------------------------------- | --------- | ------------------------------------------------------------------------------------------------ | +| [addListener(type, handler)](./puppeteer.eventemitter.addlistener.md) | | Add an event listener. | +| [emit(type, event)](./puppeteer.eventemitter.emit.md) | | Emit an event and call any associated listeners. | +| [listenerCount(type)](./puppeteer.eventemitter.listenercount.md) | | Gets the number of listeners for a given event. | +| [off(type, handler)](./puppeteer.eventemitter.off.md) | | Remove an event listener from firing. | +| [on(type, handler)](./puppeteer.eventemitter.on.md) | | Bind an event listener to fire when an event occurs. | +| [once(type, handler)](./puppeteer.eventemitter.once.md) | | Like on but the listener will only be fired once and then it will be removed. | +| [removeAllListeners(type)](./puppeteer.eventemitter.removealllisteners.md) | | Removes all listeners. If given an event argument, it will remove only listeners for that event. | +| [removeListener(type, handler)](./puppeteer.eventemitter.removelistener.md) | | Remove an event listener. | diff --git a/docs/api/puppeteer.eventemitter.off.md b/docs/api/puppeteer.eventemitter.off.md index 107082b1..bc3772bd 100644 --- a/docs/api/puppeteer.eventemitter.off.md +++ b/docs/api/puppeteer.eventemitter.off.md @@ -10,16 +10,19 @@ Remove an event listener from firing. ```typescript class EventEmitter { - off(event: EventType, handler: Handler): this; + off>( + type: Key, + handler?: Handler[Key]> + ): this; } ``` ## Parameters -| Parameter | Type | Description | -| --------- | -------------------------------------------- | ----------------------------------------------- | -| event | [EventType](./puppeteer.eventtype.md) | the event type you'd like to stop listening to. | -| handler | [Handler](./puppeteer.handler.md)<any> | the function that should be removed. | +| Parameter | Type | Description | +| --------- | --------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------- | +| type | Key | the event type you'd like to stop listening to. | +| handler | [Handler](./puppeteer.handler.md)<[EventsWithWildcard](./puppeteer.eventswithwildcard.md)<Events>\[Key\]> | _(Optional)_ the function that should be removed. | **Returns:** diff --git a/docs/api/puppeteer.eventemitter.on.md b/docs/api/puppeteer.eventemitter.on.md index f04ea8d5..66d4f13c 100644 --- a/docs/api/puppeteer.eventemitter.on.md +++ b/docs/api/puppeteer.eventemitter.on.md @@ -10,16 +10,19 @@ Bind an event listener to fire when an event occurs. ```typescript class EventEmitter { - on(event: EventType, handler: Handler): this; + on>( + type: Key, + handler: Handler[Key]> + ): this; } ``` ## Parameters -| Parameter | Type | Description | -| --------- | -------------------------------------------- | ------------------------------------------------------------------ | -| event | [EventType](./puppeteer.eventtype.md) | the event type you'd like to listen to. Can be a string or symbol. | -| handler | [Handler](./puppeteer.handler.md)<any> | the function to be called when the event occurs. | +| Parameter | Type | Description | +| --------- | --------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------ | +| type | Key | the event type you'd like to listen to. Can be a string or symbol. | +| handler | [Handler](./puppeteer.handler.md)<[EventsWithWildcard](./puppeteer.eventswithwildcard.md)<Events>\[Key\]> | the function to be called when the event occurs. | **Returns:** diff --git a/docs/api/puppeteer.eventemitter.once.md b/docs/api/puppeteer.eventemitter.once.md index 5d12b896..ade57527 100644 --- a/docs/api/puppeteer.eventemitter.once.md +++ b/docs/api/puppeteer.eventemitter.once.md @@ -10,16 +10,19 @@ Like `on` but the listener will only be fired once and then it will be removed. ```typescript class EventEmitter { - once(event: EventType, handler: Handler): this; + once>( + type: Key, + handler: Handler[Key]> + ): this; } ``` ## Parameters -| Parameter | Type | Description | -| --------- | -------------------------------------------- | ------------------------------------------------- | -| event | [EventType](./puppeteer.eventtype.md) | the event you'd like to listen to | -| handler | [Handler](./puppeteer.handler.md)<any> | the handler function to run when the event occurs | +| Parameter | Type | Description | +| --------- | --------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------- | +| type | Key | the event you'd like to listen to | +| handler | [Handler](./puppeteer.handler.md)<[EventsWithWildcard](./puppeteer.eventswithwildcard.md)<Events>\[Key\]> | the handler function to run when the event occurs | **Returns:** diff --git a/docs/api/puppeteer.eventemitter.removealllisteners.md b/docs/api/puppeteer.eventemitter.removealllisteners.md index 1badbe77..8b876d94 100644 --- a/docs/api/puppeteer.eventemitter.removealllisteners.md +++ b/docs/api/puppeteer.eventemitter.removealllisteners.md @@ -10,15 +10,15 @@ Removes all listeners. If given an event argument, it will remove only listeners ```typescript class EventEmitter { - removeAllListeners(event?: EventType): this; + removeAllListeners(type?: keyof EventsWithWildcard): this; } ``` ## Parameters -| Parameter | Type | Description | -| --------- | ------------------------------------- | ----------------------------------------------- | -| event | [EventType](./puppeteer.eventtype.md) | _(Optional)_ the event to remove listeners for. | +| Parameter | Type | Description | +| --------- | --------------------------------------------------------------------------- | ----------------------------------------------- | +| type | keyof [EventsWithWildcard](./puppeteer.eventswithwildcard.md)<Events> | _(Optional)_ the event to remove listeners for. | **Returns:** diff --git a/docs/api/puppeteer.eventemitter.removelistener.md b/docs/api/puppeteer.eventemitter.removelistener.md index 72e5ac7b..c2127ceb 100644 --- a/docs/api/puppeteer.eventemitter.removelistener.md +++ b/docs/api/puppeteer.eventemitter.removelistener.md @@ -14,16 +14,19 @@ Remove an event listener. ```typescript class EventEmitter { - removeListener(event: EventType, handler: Handler): this; + removeListener>( + type: Key, + handler: Handler[Key]> + ): this; } ``` ## Parameters -| Parameter | Type | Description | -| --------- | -------------------------------------------- | ----------- | -| event | [EventType](./puppeteer.eventtype.md) | | -| handler | [Handler](./puppeteer.handler.md)<any> | | +| Parameter | Type | Description | +| --------- | --------------------------------------------------------------------------------------------------------------------- | ----------- | +| type | Key | | +| handler | [Handler](./puppeteer.handler.md)<[EventsWithWildcard](./puppeteer.eventswithwildcard.md)<Events>\[Key\]> | | **Returns:** diff --git a/docs/api/puppeteer.eventswithwildcard.md b/docs/api/puppeteer.eventswithwildcard.md new file mode 100644 index 00000000..5a285f4a --- /dev/null +++ b/docs/api/puppeteer.eventswithwildcard.md @@ -0,0 +1,14 @@ +--- +sidebar_label: EventsWithWildcard +--- + +# EventsWithWildcard type + +#### Signature: + +```typescript +export type EventsWithWildcard> = + Events & { + '*': Events[keyof Events]; + }; +``` diff --git a/docs/api/puppeteer.eventtype.md b/docs/api/puppeteer.eventtype.md deleted file mode 100644 index db529a6a..00000000 --- a/docs/api/puppeteer.eventtype.md +++ /dev/null @@ -1,11 +0,0 @@ ---- -sidebar_label: EventType ---- - -# EventType type - -#### Signature: - -```typescript -export type EventType = string | symbol; -``` diff --git a/docs/api/puppeteer.frame.md b/docs/api/puppeteer.frame.md index 425c436a..4f23be6f 100644 --- a/docs/api/puppeteer.frame.md +++ b/docs/api/puppeteer.frame.md @@ -11,16 +11,16 @@ To understand frames, you can think of frames as `