Skip to content

Commit

Permalink
fix: Reduced the number of log for events
Browse files Browse the repository at this point in the history
  • Loading branch information
edgardmessias committed Mar 12, 2023
1 parent 10b2782 commit 5b39646
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/api/layers/listener.layer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,12 +98,13 @@ export class ListenerLayer extends ProfileLayer {
await this.page
.exposeFunction(func, (...args) => {
Promise.resolve().then(() => {
this.log(
'debug',
`Emitting ${func} event (${this.listenerEmitter.listenerCount(
func
)} registered)`
);
const count = this.listenerEmitter.listenerCount(func);
if (count > 0) {
this.log(
'debug',
`Emitting ${func} event (${count} registered)`
);
}
this.listenerEmitter.emit(func, ...args);
});
})
Expand Down

0 comments on commit 5b39646

Please sign in to comment.