chore: move static constructor to the top (#3873)
This commit is contained in:
parent
d89ec00122
commit
3c516f2114
@ -21,6 +21,20 @@ const {TaskQueue} = require('./TaskQueue');
|
||||
const {Events} = require('./Events');
|
||||
|
||||
class Browser extends EventEmitter {
|
||||
/**
|
||||
* @param {!Puppeteer.Connection} connection
|
||||
* @param {!Array<string>} contextIds
|
||||
* @param {boolean} ignoreHTTPSErrors
|
||||
* @param {?Puppeteer.Viewport} defaultViewport
|
||||
* @param {?Puppeteer.ChildProcess} process
|
||||
* @param {function()=} closeCallback
|
||||
*/
|
||||
static async create(connection, contextIds, ignoreHTTPSErrors, defaultViewport, process, closeCallback) {
|
||||
const browser = new Browser(connection, contextIds, ignoreHTTPSErrors, defaultViewport, process, closeCallback);
|
||||
await connection.send('Target.setDiscoverTargets', {discover: true});
|
||||
return browser;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {!Puppeteer.Connection} connection
|
||||
* @param {!Array<string>} contextIds
|
||||
@ -91,20 +105,6 @@ class Browser extends EventEmitter {
|
||||
this._contexts.delete(contextId);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {!Puppeteer.Connection} connection
|
||||
* @param {!Array<string>} contextIds
|
||||
* @param {boolean} ignoreHTTPSErrors
|
||||
* @param {?Puppeteer.Viewport} defaultViewport
|
||||
* @param {?Puppeteer.ChildProcess} process
|
||||
* @param {function()=} closeCallback
|
||||
*/
|
||||
static async create(connection, contextIds, ignoreHTTPSErrors, defaultViewport, process, closeCallback) {
|
||||
const browser = new Browser(connection, contextIds, ignoreHTTPSErrors, defaultViewport, process, closeCallback);
|
||||
await connection.send('Target.setDiscoverTargets', {discover: true});
|
||||
return browser;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {!Protocol.Target.targetCreatedPayload} event
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user