Have ideas to improve npm?Join in the discussion! »

    propagate

    2.0.1 • Public • Published

    propagate

    npm Build Status Coverage

    Propagate events from one event emitter into another.

    Install

    $ npm install propagate

    Propagate

    var ee1 = new EventEmitter()
    var ee2 = new EventEmitter()
    propagate(ee1, ee2)
     
    ee2.on('event', function(a, b) {
      console.log('got propagated event', a, b)
    })
     
    ee1.emit('event', 'a', 'b')

    Unpropagate

    You can unpropagate by ending the propagation like this:

    var ee1 = new EventEmitter()
    var ee2 = new EventEmitter()
    var p = propagate(ee1, ee2)
     
    // ...
     
    p.end()

    Only propagate certain events:

    var ee1 = new EventEmitter()
    var ee2 = new EventEmitter()
    var p = propagate(['event1', 'event2'], ee1, ee2)

    Propagate certain events as other events:

    var ee1 = new EventEmitter()
    var ee2 = new EventEmitter()
    var p = propagate(
      {
        event1: 'other-event1',
        event2: 'other-event2',
      },
      ee1,
      ee2
    )

    License

    MIT

    Install

    npm i propagate

    DownloadsWeekly Downloads

    1,066,015

    Version

    2.0.1

    License

    MIT

    Unpacked Size

    11 kB

    Total Files

    10

    Last publish

    Collaborators

    • avatar
    • avatar
    • avatar
    • avatar