Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

    event-sinkspublic

    event-sinks

    create a set of sinks for events

    This allows you to create an event emitter, and pass a set of sinks to someone else. Somebody else can invoke your sinks and send values to your event emitter.

    This allows you to write decoupled interfaces.

    Example

    var EventSinks = require("event-sinks")
     
    var inputs = EventSinks(["foo", "bar"])
    var emitter = inputs.emitter
    var sinks = inputs.sinks
     
    emitter.on('foo', function (ev) {
      console.log('foo', ev)
    })
    emitter.on('bar', function (ev) {
      console.log('bar', ev)
    })
     
    sinks.foo.write('hello')
    sinks.bar.write('bar')

    Example geval

    var EventSinks = require("event-sinks/geval")
     
    var inputs = EventSinks(["foo", "bar"])
    var events = inputs.events
    var sinks = inputs.sinks
     
    events.foo(function (ev) {
      console.log('foo', ev)
    })
    events.bar(function (ev) {
      console.log('bar', ev)
    })
     
    sinks.foo.write('hello')
    sinks.bar.write('bar')

    Installation

    npm install event-sinks

    Contributors

    • Raynos

    MIT Licenced

    Keywords

    none

    install

    npm i event-sinks

    Downloadslast 7 days

    9

    version

    2.2.0

    license

    none

    repository

    github.com

    last publish

    collaborators

    • avatar