import mitt , { Emitter , EventType , Handler , } from '../../vendor/mitt/src/index.js' ; public export { EventType , Handler } ; public export interface CommonEventEmitter { on ( event , handler ) : CommonEventEmitter ; off ( event , handler ) : CommonEventEmitter ; addListener ( event , handler ) : CommonEventEmitter ; removeListener ( event , handler ) : CommonEventEmitter ; emit ( event , eventData ? ) : boolean ; once ( event , handler ) : CommonEventEmitter ; listenerCount ( event ) : number ; removeAllListeners ( event ? ) : CommonEventEmitter ; } remarks This allows you to listen to events that Puppeteer classes fire and act
 * accordingly. Therefore you'll mostly use  EventEmitter . on and
 *  EventEmitter . off to bind
 * and unbind to event listeners.
 *
 *  public export class EventEmitter implements CommonEventEmitter { private emitter : Emitter ; private eventsMap = new Map < EventType , Handler [ ] > ( ) ; internal constructor ( ) { this . emitter = mitt ( this . eventsMap ) ; } param event param handler returns on ( event , handler ) { this . emitter . on ( event , handler ) ; return this ; } param event param handler returns off ( event , handler ) { this . emitter . off ( event , handler ) ; return this ; } deprecated please use  EventEmitter . off instead.
      removeListener ( event , handler ) { this . off ( event , handler ) ; return this ; } deprecated please use  EventEmitter . on instead.
      addListener ( event , handler ) { this . on ( event , handler ) ; return this ; } param event param eventData returns emit ( event , eventData ? ) { this . emitter . emit ( event , eventData ) ; return this . eventListenersCount ( event ) > 0 ; } param event param handler returns once ( event , handler ) { const onceHandler = ( eventData ) => { handler ( eventData ) ; this . off ( event , onceHandler ) ; } ; return this . on ( event , onceHandler ) ; } param event returns listenerCount ( event ) { return this . eventListenersCount ( event ) ; } param event returns removeAllListeners ( event ? ) { if ( event ) { this . eventsMap . delete ( event ) ; } else { this . eventsMap . clear ( ) ; } return this ; } private eventListenersCount ( event ) { return this . eventsMap . has ( event ) ? this . eventsMap . get ( event ) . length : 0 ; } }