mirror of
https://github.com/puppeteer/puppeteer
synced 2024-06-14 14:02:48 +00:00
chore: expose Connection methods relevant for extension (#8594)
This commit is contained in:
parent
79e11985ba
commit
468ea8fca1
@ -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<string, CDPSession> {
|
||||
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<void> {
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
protected async onMessage(message: string): Promise<void> {
|
||||
if (this.#delay) {
|
||||
await new Promise(f => {
|
||||
return setTimeout(f, this.#delay);
|
||||
|
Loading…
Reference in New Issue
Block a user