Skip to content

Commit

Permalink
feat(puppeteer): support puppeteer/start event
Browse files Browse the repository at this point in the history
  • Loading branch information
shigma committed Apr 12, 2021
1 parent 959fa2b commit ad9aa35
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions packages/plugin-puppeteer/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ declare module 'koishi-core' {
}

interface EventMap {
'puppeteer/start'(): void
'puppeteer/validate'(url: string): string
}
}
Expand Down Expand Up @@ -72,6 +73,7 @@ export function apply(ctx: Context, config: Config = {}) {
}
defineProperty(ctx.app, 'browser', await puppeteer.launch(config.browser))
logger.debug('browser launched')
ctx.emit('puppeteer/start')
} catch (error) {
logger.error(error)
ctx.dispose()
Expand Down

0 comments on commit ad9aa35

Please sign in to comment.