if (!this.browser) {
this.browser = await puppeteer.launch(this.OPT)
const pages: puppeteer.Page[] = await this.browser.pages()
// close chromium by catching 'targetdestryed'
this.browser.on('targetdestroyed', async () => {
if (this.browser) {
const pages: puppeteer.Page[] = await this.browser.pages()
if (pages.length === 0) {
process.exit(0)
}
}
})
}