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

    hitmanpublic

    hitman

    Build Status

    It's all about fulfilling contracts.

    Happy path (works just like an EventEmitter):

     
      var Hitman = require('hitman').Hitman;
     
      var emitter = new Hitman(['1', '2']);
     
      emitter.on('1', function() {
        console.log('hello world');
      });
     
      emitter.emit('1');
     

    Wrapping an external EventEmitter:

     
      var Hitman       = require('hitman').Hitman,
          EventEmitter = require('events').EventEmitter;
     
      var ext_emitter = new EventEmitter(),
          emitter = new Hitman(['1', '2'], { emitter: ext_emitter });
     
      emitter.on('1', function() {
        console.log('hello world');
      });
     
      emitter.emit('1');
     

    Both of the following examples will throw an error:

     
      var Hitman = require('hitman').Hitman;
     
      var emitter = new Hitman(['1', '2']);
     
      emitter.on('3', function() {
        console.log('hello world');
      });
     
     
      var Hitman = require('hitman').Hitman;
     
      var emitter = new Hitman(['1', '2']);
     
      emitter.emit('3');
     

    Keywords

    none

    install

    npm i hitman

    Downloadslast 7 days

    4

    version

    0.0.2

    license

    none

    repository

    github.com

    last publish

    collaborators

    • avatar