diff --git a/docs/api/index.md b/docs/api/index.md index 2fd071718a1..6215e543c3d 100644 --- a/docs/api/index.md +++ b/docs/api/index.md @@ -134,6 +134,12 @@ sidebar_label: API | [WaitForTargetOptions](./puppeteer.waitfortargetoptions.md) | | | [WaitTimeoutOptions](./puppeteer.waittimeoutoptions.md) | | +## Namespaces + +| Namespace | Description | +| ------------------------------------------------- | --------------------------------------- | +| [CDPSessionEvent](./puppeteer.cdpsessionevent.md) | Events that the CDPSession class emits. | + ## Variables | Variable | Description | diff --git a/docs/api/puppeteer.cdpsessionevent.md b/docs/api/puppeteer.cdpsessionevent.md new file mode 100644 index 00000000000..ae877413fe6 --- /dev/null +++ b/docs/api/puppeteer.cdpsessionevent.md @@ -0,0 +1,20 @@ +--- +sidebar_label: CDPSessionEvent +--- + +# CDPSessionEvent namespace + +Events that the CDPSession class emits. + +#### Signature: + +```typescript +export declare namespace CDPSessionEvent +``` + +## Variables + +| Variable | Description | +| ----------------------------------------------------------------- | ----------- | +| [SessionAttached](./puppeteer.cdpsessionevent.sessionattached.md) | | +| [SessionDetached](./puppeteer.cdpsessionevent.sessiondetached.md) | | diff --git a/docs/api/puppeteer.cdpsessionevent.sessionattached.md b/docs/api/puppeteer.cdpsessionevent.sessionattached.md new file mode 100644 index 00000000000..fe3be321c4e --- /dev/null +++ b/docs/api/puppeteer.cdpsessionevent.sessionattached.md @@ -0,0 +1,11 @@ +--- +sidebar_label: CDPSessionEvent.SessionAttached +--- + +# CDPSessionEvent.SessionAttached variable + +#### Signature: + +```typescript +SessionAttached: 'sessionattached'; +``` diff --git a/docs/api/puppeteer.cdpsessionevent.sessiondetached.md b/docs/api/puppeteer.cdpsessionevent.sessiondetached.md new file mode 100644 index 00000000000..6721c118c6f --- /dev/null +++ b/docs/api/puppeteer.cdpsessionevent.sessiondetached.md @@ -0,0 +1,11 @@ +--- +sidebar_label: CDPSessionEvent.SessionDetached +--- + +# CDPSessionEvent.SessionDetached variable + +#### Signature: + +```typescript +SessionDetached: 'sessiondetached'; +``` diff --git a/docs/api/puppeteer.cdpsessionevents.md b/docs/api/puppeteer.cdpsessionevents.md index d7365a4d4f1..6804162cab2 100644 --- a/docs/api/puppeteer.cdpsessionevents.md +++ b/docs/api/puppeteer.cdpsessionevents.md @@ -11,3 +11,10 @@ export interface CDPSessionEvents extends CDPEvents, Record ``` **Extends:** [CDPEvents](./puppeteer.cdpevents.md), Record<EventType, unknown> + +## Properties + +| Property | Modifiers | Type | Description | Default | +| --------------- | --------- | --------------------------------------- | ----------- | ------- | +| sessionattached | | [CDPSession](./puppeteer.cdpsession.md) | | | +| sessiondetached | | [CDPSession](./puppeteer.cdpsession.md) | | | diff --git a/packages/puppeteer-core/src/api/CDPSession.ts b/packages/puppeteer-core/src/api/CDPSession.ts index 834b1ac1c46..bfe39fb1c70 100644 --- a/packages/puppeteer-core/src/api/CDPSession.ts +++ b/packages/puppeteer-core/src/api/CDPSession.ts @@ -11,21 +11,25 @@ export type CDPEvents = { }; /** - * Internal events that the CDPSession class emits. + * Events that the CDPSession class emits. * - * @internal + * @public */ // eslint-disable-next-line @typescript-eslint/no-namespace export namespace CDPSessionEvent { + /** @internal */ export const Disconnected = Symbol('CDPSession.Disconnected'); + /** @internal */ export const Swapped = Symbol('CDPSession.Swapped'); /** * Emitted when the session is ready to be configured during the auto-attach * process. Right after the event is handled, the session will be resumed. + * + * @internal */ export const Ready = Symbol('CDPSession.Ready'); - export const SessionAttached = Symbol('CDPSession.SessionAttached'); - export const SessionDetached = Symbol('CDPSession.SessionDetached'); + export const SessionAttached = 'sessionattached' as const; + export const SessionDetached = 'sessiondetached' as const; } /** @@ -40,9 +44,7 @@ export interface CDPSessionEvents [CDPSessionEvent.Swapped]: CDPSession; /** @internal */ [CDPSessionEvent.Ready]: CDPSession; - /** @internal */ [CDPSessionEvent.SessionAttached]: CDPSession; - /** @internal */ [CDPSessionEvent.SessionDetached]: CDPSession; }