event-bulk-attach

1.0.1 • Public • Published

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

/event-bulk-attach/

    Package Sidebar

    Install

    npm i event-bulk-attach

    Weekly Downloads

    2

    Version

    1.0.1

    License

    MIT

    Last publish

    Collaborators

    • yoshuawuyts