This package has been deprecated

Author message:

Renamed to @metamask/safe-event-emitter

safe-event-emitter

1.0.1 • Public • Published

safe-event-emitter

An EventEmitter that isolates the emitter from errors in handlers. If an error is thrown in a handler it is caught and re-thrown inside of a setTimeout so as to not interupt the emitter's code flow.

API is the same as EventEmitter.

usage

const SafeEventEmitter = require('safe-event-emitter')
 
const ee = new SafeEventEmitter()
ee.on('boom', () => { throw new Error() })
ee.emit('boom') // no error here
 
// error is thrown after setTimeout

Readme

Keywords

none

Package Sidebar

Install

npm i safe-event-emitter

Weekly Downloads

71,579

Version

1.0.1

License

ISC

Unpacked Size

2.97 kB

Total Files

3

Last publish

Collaborators

  • mcmire
  • nicholasellul
  • lgbot
  • naugtur
  • ritave
  • danfinlay
  • kumavis
  • rekmarks
  • metamaskbot
  • gudahtt
  • sethkfman