Skip to content

Commit

Permalink
chore: move static constructor to the top (#3873)
Browse files Browse the repository at this point in the history
  • Loading branch information
aslushnikov committed Feb 1, 2019
1 parent d89ec00 commit 3c516f2
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions lib/Browser.js
Expand Up @@ -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
Expand Down Expand Up @@ -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
*/
Expand Down

0 comments on commit 3c516f2

Please sign in to comment.