diff --git a/new-docs/puppeteer.connection._callbacks.md b/new-docs/puppeteer.connection._callbacks.md
deleted file mode 100644
index 1ec6b3ad..00000000
--- a/new-docs/puppeteer.connection._callbacks.md
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-[Home](./index.md) > [puppeteer](./puppeteer.md) > [Connection](./puppeteer.connection.md) > [\_callbacks](./puppeteer.connection._callbacks.md)
-
-## Connection.\_callbacks property
-
-Signature:
-
-```typescript
-_callbacks: Map;
-```
diff --git a/new-docs/puppeteer.connection._closed.md b/new-docs/puppeteer.connection._closed.md
deleted file mode 100644
index 7ec20641..00000000
--- a/new-docs/puppeteer.connection._closed.md
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-[Home](./index.md) > [puppeteer](./puppeteer.md) > [Connection](./puppeteer.connection.md) > [\_closed](./puppeteer.connection._closed.md)
-
-## Connection.\_closed property
-
-Signature:
-
-```typescript
-_closed: boolean;
-```
diff --git a/new-docs/puppeteer.connection._constructor_.md b/new-docs/puppeteer.connection._constructor_.md
deleted file mode 100644
index 328638a3..00000000
--- a/new-docs/puppeteer.connection._constructor_.md
+++ /dev/null
@@ -1,22 +0,0 @@
-
-
-[Home](./index.md) > [puppeteer](./puppeteer.md) > [Connection](./puppeteer.connection.md) > [(constructor)](./puppeteer.connection._constructor_.md)
-
-## Connection.(constructor)
-
-Constructs a new instance of the `Connection` class
-
-Signature:
-
-```typescript
-constructor(url: string, transport: ConnectionTransport, delay?: number);
-```
-
-## Parameters
-
-| Parameter | Type | Description |
-| --- | --- | --- |
-| url | string | |
-| transport | ConnectionTransport | |
-| delay | number | |
-
diff --git a/new-docs/puppeteer.connection._delay.md b/new-docs/puppeteer.connection._delay.md
deleted file mode 100644
index 6a6357f7..00000000
--- a/new-docs/puppeteer.connection._delay.md
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-[Home](./index.md) > [puppeteer](./puppeteer.md) > [Connection](./puppeteer.connection.md) > [\_delay](./puppeteer.connection._delay.md)
-
-## Connection.\_delay property
-
-Signature:
-
-```typescript
-_delay: number;
-```
diff --git a/new-docs/puppeteer.connection._lastid.md b/new-docs/puppeteer.connection._lastid.md
deleted file mode 100644
index 28f48305..00000000
--- a/new-docs/puppeteer.connection._lastid.md
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-[Home](./index.md) > [puppeteer](./puppeteer.md) > [Connection](./puppeteer.connection.md) > [\_lastId](./puppeteer.connection._lastid.md)
-
-## Connection.\_lastId property
-
-Signature:
-
-```typescript
-_lastId: number;
-```
diff --git a/new-docs/puppeteer.connection._onclose.md b/new-docs/puppeteer.connection._onclose.md
deleted file mode 100644
index bb3fc7a4..00000000
--- a/new-docs/puppeteer.connection._onclose.md
+++ /dev/null
@@ -1,15 +0,0 @@
-
-
-[Home](./index.md) > [puppeteer](./puppeteer.md) > [Connection](./puppeteer.connection.md) > [\_onClose](./puppeteer.connection._onclose.md)
-
-## Connection.\_onClose() method
-
-Signature:
-
-```typescript
-_onClose(): void;
-```
-Returns:
-
-void
-
diff --git a/new-docs/puppeteer.connection._onmessage.md b/new-docs/puppeteer.connection._onmessage.md
deleted file mode 100644
index 93381396..00000000
--- a/new-docs/puppeteer.connection._onmessage.md
+++ /dev/null
@@ -1,22 +0,0 @@
-
-
-[Home](./index.md) > [puppeteer](./puppeteer.md) > [Connection](./puppeteer.connection.md) > [\_onMessage](./puppeteer.connection._onmessage.md)
-
-## Connection.\_onMessage() method
-
-Signature:
-
-```typescript
-_onMessage(message: string): Promise;
-```
-
-## Parameters
-
-| Parameter | Type | Description |
-| --- | --- | --- |
-| message | string | |
-
-Returns:
-
-Promise<void>
-
diff --git a/new-docs/puppeteer.connection._rawsend.md b/new-docs/puppeteer.connection._rawsend.md
deleted file mode 100644
index b54a6389..00000000
--- a/new-docs/puppeteer.connection._rawsend.md
+++ /dev/null
@@ -1,22 +0,0 @@
-
-
-[Home](./index.md) > [puppeteer](./puppeteer.md) > [Connection](./puppeteer.connection.md) > [\_rawSend](./puppeteer.connection._rawsend.md)
-
-## Connection.\_rawSend() method
-
-Signature:
-
-```typescript
-_rawSend(message: {}): number;
-```
-
-## Parameters
-
-| Parameter | Type | Description |
-| --- | --- | --- |
-| message | {} | |
-
-Returns:
-
-number
-
diff --git a/new-docs/puppeteer.connection._sessions.md b/new-docs/puppeteer.connection._sessions.md
deleted file mode 100644
index 4037b0ba..00000000
--- a/new-docs/puppeteer.connection._sessions.md
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-[Home](./index.md) > [puppeteer](./puppeteer.md) > [Connection](./puppeteer.connection.md) > [\_sessions](./puppeteer.connection._sessions.md)
-
-## Connection.\_sessions property
-
-Signature:
-
-```typescript
-_sessions: Map;
-```
diff --git a/new-docs/puppeteer.connection._transport.md b/new-docs/puppeteer.connection._transport.md
deleted file mode 100644
index 20b3ea22..00000000
--- a/new-docs/puppeteer.connection._transport.md
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-[Home](./index.md) > [puppeteer](./puppeteer.md) > [Connection](./puppeteer.connection.md) > [\_transport](./puppeteer.connection._transport.md)
-
-## Connection.\_transport property
-
-Signature:
-
-```typescript
-_transport: ConnectionTransport;
-```
diff --git a/new-docs/puppeteer.connection._url.md b/new-docs/puppeteer.connection._url.md
deleted file mode 100644
index c19a8769..00000000
--- a/new-docs/puppeteer.connection._url.md
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-[Home](./index.md) > [puppeteer](./puppeteer.md) > [Connection](./puppeteer.connection.md) > [\_url](./puppeteer.connection._url.md)
-
-## Connection.\_url property
-
-Signature:
-
-```typescript
-_url: string;
-```
diff --git a/new-docs/puppeteer.connection.createsession.md b/new-docs/puppeteer.connection.createsession.md
deleted file mode 100644
index 7cf05505..00000000
--- a/new-docs/puppeteer.connection.createsession.md
+++ /dev/null
@@ -1,24 +0,0 @@
-
-
-[Home](./index.md) > [puppeteer](./puppeteer.md) > [Connection](./puppeteer.connection.md) > [createSession](./puppeteer.connection.createsession.md)
-
-## Connection.createSession() method
-
-Signature:
-
-```typescript
-createSession(targetInfo: Protocol.Target.TargetInfo): Promise;
-```
-
-## Parameters
-
-| Parameter | Type | Description |
-| --- | --- | --- |
-| targetInfo | Protocol.Target.TargetInfo | |
-
-Returns:
-
-Promise<[CDPSession](./puppeteer.cdpsession.md)>
-
-{!Promise<!CDPSession>}
-
diff --git a/new-docs/puppeteer.connection.dispose.md b/new-docs/puppeteer.connection.dispose.md
deleted file mode 100644
index 39fc899e..00000000
--- a/new-docs/puppeteer.connection.dispose.md
+++ /dev/null
@@ -1,15 +0,0 @@
-
-
-[Home](./index.md) > [puppeteer](./puppeteer.md) > [Connection](./puppeteer.connection.md) > [dispose](./puppeteer.connection.dispose.md)
-
-## Connection.dispose() method
-
-Signature:
-
-```typescript
-dispose(): void;
-```
-Returns:
-
-void
-
diff --git a/new-docs/puppeteer.connection.fromsession.md b/new-docs/puppeteer.connection.fromsession.md
deleted file mode 100644
index f6eac4ef..00000000
--- a/new-docs/puppeteer.connection.fromsession.md
+++ /dev/null
@@ -1,22 +0,0 @@
-
-
-[Home](./index.md) > [puppeteer](./puppeteer.md) > [Connection](./puppeteer.connection.md) > [fromSession](./puppeteer.connection.fromsession.md)
-
-## Connection.fromSession() method
-
-Signature:
-
-```typescript
-static fromSession(session: CDPSession): Connection;
-```
-
-## Parameters
-
-| Parameter | Type | Description |
-| --- | --- | --- |
-| session | [CDPSession](./puppeteer.cdpsession.md) | |
-
-Returns:
-
-[Connection](./puppeteer.connection.md)
-
diff --git a/new-docs/puppeteer.connection.md b/new-docs/puppeteer.connection.md
deleted file mode 100644
index 75fff814..00000000
--- a/new-docs/puppeteer.connection.md
+++ /dev/null
@@ -1,45 +0,0 @@
-
-
-[Home](./index.md) > [puppeteer](./puppeteer.md) > [Connection](./puppeteer.connection.md)
-
-## Connection class
-
-Signature:
-
-```typescript
-export declare class Connection extends EventEmitter
-```
-Extends: [EventEmitter](./puppeteer.eventemitter.md)
-
-## Constructors
-
-| Constructor | Modifiers | Description |
-| --- | --- | --- |
-| [(constructor)(url, transport, delay)](./puppeteer.connection._constructor_.md) | | Constructs a new instance of the Connection
class |
-
-## Properties
-
-| Property | Modifiers | Type | Description |
-| --- | --- | --- | --- |
-| [\_callbacks](./puppeteer.connection._callbacks.md) | | Map<number, ConnectionCallback> | |
-| [\_closed](./puppeteer.connection._closed.md) | | boolean | |
-| [\_delay](./puppeteer.connection._delay.md) | | number | |
-| [\_lastId](./puppeteer.connection._lastid.md) | | number | |
-| [\_sessions](./puppeteer.connection._sessions.md) | | Map<string, [CDPSession](./puppeteer.cdpsession.md)> | |
-| [\_transport](./puppeteer.connection._transport.md) | | ConnectionTransport | |
-| [\_url](./puppeteer.connection._url.md) | | string | |
-
-## Methods
-
-| Method | Modifiers | Description |
-| --- | --- | --- |
-| [\_onClose()](./puppeteer.connection._onclose.md) | | |
-| [\_onMessage(message)](./puppeteer.connection._onmessage.md) | | |
-| [\_rawSend(message)](./puppeteer.connection._rawsend.md) | | |
-| [createSession(targetInfo)](./puppeteer.connection.createsession.md) | | |
-| [dispose()](./puppeteer.connection.dispose.md) | | |
-| [fromSession(session)](./puppeteer.connection.fromsession.md) | static
| |
-| [send(method, params)](./puppeteer.connection.send.md) | | |
-| [session(sessionId)](./puppeteer.connection.session.md) | | |
-| [url()](./puppeteer.connection.url.md) | | |
-
diff --git a/new-docs/puppeteer.connection.send.md b/new-docs/puppeteer.connection.send.md
deleted file mode 100644
index f5efddda..00000000
--- a/new-docs/puppeteer.connection.send.md
+++ /dev/null
@@ -1,23 +0,0 @@
-
-
-[Home](./index.md) > [puppeteer](./puppeteer.md) > [Connection](./puppeteer.connection.md) > [send](./puppeteer.connection.send.md)
-
-## Connection.send() method
-
-Signature:
-
-```typescript
-send(method: T, params?: Protocol.CommandParameters[T]): Promise;
-```
-
-## Parameters
-
-| Parameter | Type | Description |
-| --- | --- | --- |
-| method | T | |
-| params | Protocol.CommandParameters\[T\] | |
-
-Returns:
-
-Promise<Protocol.CommandReturnValues\[T\]>
-
diff --git a/new-docs/puppeteer.connection.session.md b/new-docs/puppeteer.connection.session.md
deleted file mode 100644
index 6ccf1a47..00000000
--- a/new-docs/puppeteer.connection.session.md
+++ /dev/null
@@ -1,24 +0,0 @@
-
-
-[Home](./index.md) > [puppeteer](./puppeteer.md) > [Connection](./puppeteer.connection.md) > [session](./puppeteer.connection.session.md)
-
-## Connection.session() method
-
-Signature:
-
-```typescript
-session(sessionId: string): CDPSession | null;
-```
-
-## Parameters
-
-| Parameter | Type | Description |
-| --- | --- | --- |
-| sessionId | string | |
-
-Returns:
-
-[CDPSession](./puppeteer.cdpsession.md) \| null
-
-{?CDPSession}
-
diff --git a/new-docs/puppeteer.connection.url.md b/new-docs/puppeteer.connection.url.md
deleted file mode 100644
index 7bf111df..00000000
--- a/new-docs/puppeteer.connection.url.md
+++ /dev/null
@@ -1,15 +0,0 @@
-
-
-[Home](./index.md) > [puppeteer](./puppeteer.md) > [Connection](./puppeteer.connection.md) > [url](./puppeteer.connection.url.md)
-
-## Connection.url() method
-
-Signature:
-
-```typescript
-url(): string;
-```
-Returns:
-
-string
-
diff --git a/new-docs/puppeteer.md b/new-docs/puppeteer.md
index ff7dc9b0..7a4c2b03 100644
--- a/new-docs/puppeteer.md
+++ b/new-docs/puppeteer.md
@@ -13,7 +13,6 @@
| [BrowserContext](./puppeteer.browsercontext.md) | BrowserContexts provide a way to operate multiple independent browser sessions. When a browser is launched, it has a single BrowserContext used by default. The method [Browser.newPage](./puppeteer.browser.newpage.md) creates a page in the default browser context. |
| [BrowserFetcher](./puppeteer.browserfetcher.md) | BrowserFetcher can download and manage different versions of Chromium and Firefox. |
| [CDPSession](./puppeteer.cdpsession.md) | The CDPSession
instances are used to talk raw Chrome Devtools Protocol. |
-| [Connection](./puppeteer.connection.md) | |
| [ConsoleMessage](./puppeteer.consolemessage.md) | ConsoleMessage objects are dispatched by page via the 'console' event. |
| [Coverage](./puppeteer.coverage.md) | The Coverage class provides methods to gathers information about parts of JavaScript and CSS that were used by the page. |
| [Dialog](./puppeteer.dialog.md) | Dialog instances are dispatched by the [Page](./puppeteer.page.md) via the dialog
event. |
diff --git a/src/common/Browser.ts b/src/common/Browser.ts
index 52d13e7c..0ae871b0 100644
--- a/src/common/Browser.ts
+++ b/src/common/Browser.ts
@@ -18,9 +18,8 @@ import { assert } from './assert';
import { helper } from './helper';
import { Target } from './Target';
import { EventEmitter } from './EventEmitter';
-import { Events } from './Events';
import Protocol from '../protocol';
-import { Connection } from './Connection';
+import { Connection, ConnectionEmittedEvents } from './Connection';
import { Page } from './Page';
import { ChildProcess } from 'child_process';
import { Viewport } from './PuppeteerViewport';
@@ -194,7 +193,7 @@ export class Browser extends EventEmitter {
);
this._targets = new Map();
- this._connection.on(Events.Connection.Disconnected, () =>
+ this._connection.on(ConnectionEmittedEvents.Disconnected, () =>
this.emit(BrowserEmittedEvents.Disconnected)
);
this._connection.on('Target.targetCreated', this._targetCreated.bind(this));
diff --git a/src/common/Connection.ts b/src/common/Connection.ts
index dcf22d67..e59ec7bd 100644
--- a/src/common/Connection.ts
+++ b/src/common/Connection.ts
@@ -14,7 +14,6 @@
* limitations under the License.
*/
import { assert } from './assert';
-import { Events } from './Events';
import { debug } from './Debug';
const debugProtocolSend = debug('puppeteer:protocol:SEND ►');
const debugProtocolReceive = debug('puppeteer:protocol:RECV ◀');
@@ -30,6 +29,18 @@ interface ConnectionCallback {
method: string;
}
+/**
+ * Internal events that the Connection class emits.
+ *
+ * @internal
+ */
+export const ConnectionEmittedEvents = {
+ Disconnected: Symbol('Connection.Disconnected'),
+} as const;
+
+/**
+ * @internal
+ */
export class Connection extends EventEmitter {
_url: string;
_transport: ConnectionTransport;
@@ -137,7 +148,7 @@ export class Connection extends EventEmitter {
this._callbacks.clear();
for (const session of this._sessions.values()) session._onClosed();
this._sessions.clear();
- this.emit(Events.Connection.Disconnected);
+ this.emit(ConnectionEmittedEvents.Disconnected);
}
dispose(): void {
@@ -168,6 +179,15 @@ interface CDPSessionOnMessageObject {
result?: any;
}
+/**
+ * Internal events that the CDPSession class emits.
+ *
+ * @internal
+ */
+export const CDPSessionEmittedEvents = {
+ Disconnected: Symbol('CDPSession.Disconnected'),
+} as const;
+
/**
* The `CDPSession` instances are used to talk raw Chrome Devtools Protocol.
*
@@ -283,7 +303,7 @@ export class CDPSession extends EventEmitter {
);
this._callbacks.clear();
this._connection = null;
- this.emit(Events.CDPSession.Disconnected);
+ this.emit(CDPSessionEmittedEvents.Disconnected);
}
}
diff --git a/src/common/LifecycleWatcher.ts b/src/common/LifecycleWatcher.ts
index 32787c60..bd64a567 100644
--- a/src/common/LifecycleWatcher.ts
+++ b/src/common/LifecycleWatcher.ts
@@ -22,6 +22,7 @@ import { FrameManager, Frame, FrameManagerEmittedEvents } from './FrameManager';
import { HTTPRequest } from './HTTPRequest';
import { HTTPResponse } from './HTTPResponse';
import { NetworkManagerEmittedEvents } from './NetworkManager';
+import { CDPSessionEmittedEvents } from './Connection';
export type PuppeteerLifeCycleEvent =
| 'load'
@@ -95,7 +96,7 @@ export class LifecycleWatcher {
this._eventListeners = [
helper.addEventListener(
frameManager._client,
- Events.CDPSession.Disconnected,
+ CDPSessionEmittedEvents.Disconnected,
() =>
this._terminate(
new Error('Navigation failed because browser has disconnected!')
diff --git a/src/common/Page.ts b/src/common/Page.ts
index 51598153..63e1a40a 100644
--- a/src/common/Page.ts
+++ b/src/common/Page.ts
@@ -19,7 +19,7 @@ import { promisify } from 'util';
import { EventEmitter } from './EventEmitter';
import * as mime from 'mime';
import { Events } from './Events';
-import { Connection, CDPSession } from './Connection';
+import { Connection, CDPSession, CDPSessionEmittedEvents } from './Connection';
import { Dialog } from './Dialog';
import { EmulationManager } from './EmulationManager';
import { Frame, FrameManager, FrameManagerEmittedEvents } from './FrameManager';
@@ -1325,7 +1325,7 @@ export class Page extends EventEmitter {
private _sessionClosePromise(): Promise {
if (!this._disconnectPromise)
this._disconnectPromise = new Promise((fulfill) =>
- this._client.once(Events.CDPSession.Disconnected, () =>
+ this._client.once(CDPSessionEmittedEvents.Disconnected, () =>
fulfill(new Error('Target closed'))
)
);