fix: make pupBrowser and pupPage available sooner (#137)

* move this.pupBrowser variable to line 51 to resolve not being able to close the browser when it is not connected to the internet

* move pupPage along with pupBrowser

Co-authored-by: Pedro S. Lopez <pedroslopez@me.com>
This commit is contained in:
kurob1993
2020-04-06 10:04:03 +07:00
committed by GitHub
parent 7acbd3d800
commit 1780436b93

View File

@@ -48,6 +48,9 @@ class Client extends EventEmitter {
const page = (await browser.pages())[0];
page.setUserAgent(UserAgent);
this.pupBrowser = browser;
this.pupPage = page;
if (this.options.session) {
await page.evaluateOnNewDocument(
session => {
@@ -303,9 +306,6 @@ class Client extends EventEmitter {
window.Store.AppState.on('change:state', (_AppState, state) => { window.onAppStateChangedEvent(state); });
});
this.pupBrowser = browser;
this.pupPage = page;
/**
* Emitted when the client has initialized and is ready to receive messages.
* @event Client#ready