From 468ea8fca1337d1a3d5786a05732953f090eb472 Mon Sep 17 00:00:00 2001 From: Alex Rudenko Date: Tue, 28 Jun 2022 14:48:29 +0200 Subject: [PATCH] chore: expose Connection methods relevant for extension (#8594) --- src/common/Connection.ts | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/common/Connection.ts b/src/common/Connection.ts index 0b5c46f5bec..8cfc061bcc3 100644 --- a/src/common/Connection.ts +++ b/src/common/Connection.ts @@ -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); } @@ -81,6 +81,13 @@ export class Connection extends EventEmitter { return this.#closed; } + /** + * @internal + */ + get _sessions(): Map { + return this.#sessions; + } + /** * @param sessionId - The session id * @returns The current CDP session if it exists @@ -126,7 +133,10 @@ export class Connection extends EventEmitter { return id; } - async #onMessage(message: string): Promise { + /** + * @internal + */ + protected async onMessage(message: string): Promise { if (this.#delay) { await new Promise(f => { return setTimeout(f, this.#delay);