Class: EventEmitter

util. EventEmitter

A minimal event emitter.

new util.EventEmitter()

Constructs a new event emitter instance.

Methods

emit(evt, args){ this }

Emits an event by calling its listeners with the specified arguments.

Name Type Description
evt string

Event name

args * repeatable

Arguments

Returns:
Type Description
this this

off(evt, fn){ this }

Removes an event listener or any matching listeners if arguments are omitted.

Name Type Description
evt string optional

Event name. Removes all listeners if omitted.

fn EventEmitterListener optional

Listener to remove. Removes all listeners of evt if omitted.

Returns:
Type Description
this this

on(evt, fn, ctx){ this }

Registers an event listener.

Name Type Description
evt string

Event name

fn EventEmitterListener

Listener

ctx * optional

Listener context

Returns:
Type Description
this this