puppeteer/website/versioned_docs/version-10.0.0/puppeteer.eventemitter.md
TASNEEM KOUSHAR 34ff00e2fe
chore(docs): generate site for v10.0.0
* fix: added parts of website

* fix: removed unnecessary lines

* fix: updated contributing.md

* fix: added parts of sidebar

* fix: added all APIs

* fix: added version 10.0.0

Co-authored-by: Jack Franklin <jacktfranklin@chromium.org>
2021-08-09 09:57:14 +01:00

1.9 KiB

Home > puppeteer > EventEmitter

EventEmitter class

The EventEmitter class that many Puppeteer classes extend.

Signature:

export declare class EventEmitter implements CommonEventEmitter 

Implements: CommonEventEmitter

Remarks

This allows you to listen to events that Puppeteer classes fire and act accordingly. Therefore you'll mostly use on and off to bind and unbind to event listeners.

The constructor for this class is marked as internal. Third-party code should not call the constructor directly or create subclasses that extend the EventEmitter class.

Methods

Method Modifiers Description
addListener(event, handler) Add an event listener.
emit(event, eventData) Emit an event and call any associated listeners.
listenerCount(event) Gets the number of listeners for a given event.
off(event, handler) Remove an event listener from firing.
on(event, handler) Bind an event listener to fire when an event occurs.
once(event, handler) Like on but the listener will only be fired once and then it will be removed.
removeAllListeners(event) Removes all listeners. If given an event argument, it will remove only listeners for that event.
removeListener(event, handler) Remove an event listener.