1.0.1 • Published 10 years ago

event-bulk-attach v1.0.1

Weekly downloads
1
License
MIT
Repository
github
Last release
10 years ago

event-bulk-attach

NPM version build status Test coverage Downloads js-standard-style

Attach events to a listener in bulk. Creates an event emitter if none is provided.

Installation

$ npm install event-bulk-attach

Usage

const EventEmitter = require('events').EventEmitter
const attach = require('event-bulk-attach')

const events = {
  foo: [barFn, binFn],
  err: [errFn, blaFn],
  oii: beepFn
}

const emitter = attach(new EventEmitter(), events)

emitter.emit('foo')
// barFn & binFn are called

See Also

License

MIT