Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/pptr/src/EventEmitter.ts>EventEmitter

Headless Chrome Deno API
Latest
class EventEmitter
implements CommonEventEmitter
import { EventEmitter } from "https://deno.land/x/pptr@1.2.0/src/EventEmitter.ts";

The EventEmitter class that many Puppeteer classes extend.

Constructors

new
EventEmitter()

Properties

private
emitter: Emitter
private
eventsMap: Map<EventType, Handler[]>

Methods

private
eventListenersCount(event: EventType): number
deprecated
addListener(event: EventType, handler: Handler): EventEmitter

Add an event listener.

emit(event: EventType, eventData?: any): boolean

Emit an event and call any associated listeners.

listenerCount(event: EventType): number

Gets the number of listeners for a given event.

off(event: EventType, handler: Handler): EventEmitter

Remove an event listener from firing.

on(event: EventType, handler: Handler): EventEmitter

Bind an event listener to fire when an event occurs.

once(event: EventType, handler: Handler): EventEmitter

Like on but the listener will only be fired once and then it will be removed.

Removes all listeners. If given an event argument, it will remove only listeners for that event.

deprecated
removeListener(event: EventType, handler: Handler): EventEmitter

Remove an event listener.