fix(core): update

This commit is contained in:
2021-01-08 21:16:25 +00:00
parent 1b72af4702
commit ef55253b8e
10 changed files with 112 additions and 41 deletions

View File

@@ -5,9 +5,7 @@ export class IncognitoBrowser {
public status: 'started' | 'stopped' = 'stopped';
public browser: plugins.puppeteer.Browser;
constructor() {
}
constructor() {}
/**
* starts the IncognitoBrowser
@@ -15,14 +13,14 @@ export class IncognitoBrowser {
public async start() {
this.status = 'started';
this.browser = await getEnvAwareBrowserInstance();
this.browser.addListener('disconnected', async eventArg => {
this.browser.addListener('disconnected', async (eventArg) => {
try {
this.browser.removeAllListeners();
} catch(err) {}
} catch (err) {}
if (this.status === 'started') {
this.browser = await getEnvAwareBrowserInstance();
}
})
});
}
/**
@@ -39,4 +37,4 @@ export class IncognitoBrowser {
throw new Error('you need to start the IncognitoBrowser instance first');
}
}
}
}