Skip to content

Commit

Permalink
chore: expose Connection methods relevant for extension (#8594)
Browse files Browse the repository at this point in the history
  • Loading branch information
OrKoN committed Jun 28, 2022
1 parent 79e1198 commit 468ea8f
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/common/Connection.ts
Expand Up @@ -66,7 +66,7 @@ export class Connection extends EventEmitter {
this.#delay = delay;

this.#transport = transport;
this.#transport.onmessage = this.#onMessage.bind(this);
this.#transport.onmessage = this.onMessage.bind(this);
this.#transport.onclose = this.#onClose.bind(this);
}

Expand All @@ -81,6 +81,13 @@ export class Connection extends EventEmitter {
return this.#closed;
}

/**
* @internal
*/
get _sessions(): Map<string, CDPSession> {
return this.#sessions;
}

/**
* @param sessionId - The session id
* @returns The current CDP session if it exists
Expand Down Expand Up @@ -126,7 +133,10 @@ export class Connection extends EventEmitter {
return id;
}

async #onMessage(message: string): Promise<void> {
/**
* @internal
*/
protected async onMessage(message: string): Promise<void> {
if (this.#delay) {
await new Promise(f => {
return setTimeout(f, this.#delay);
Expand Down

0 comments on commit 468ea8f

Please sign in to comment.