Skip to content

Latest commit

 

History

History
19 lines (10 loc) · 437 Bytes

README.md

File metadata and controls

19 lines (10 loc) · 437 Bytes

then-on

promises for events

Installation

npm install then-on

API

on(emitter, event, errorEvent = 'error')

returns a promise.

emitter.on(event, resolve)

if the errorEvent is not explicitly null, undefined, false or otherwise falsy, emitter.on(errorEvent, reject)

it makes use of .once instead of .on if present, and uses .removeListener to remove the uncalled handler if it's available.