Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
EventEmitter mixin
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
test
History.md
Makefile
Readme.md
index.js
package.json

Readme.md

Node EventEmitter mixin.

Example

var emitter = require('emitter-mixin');

function Person () {}
emitter(Person.prototype);

var person = new Person();
person.on('foo', function (arg) {
  console.log(arg);
}).emit('foo', 'bar');

// > bar

You don't have to do Emitter.call(this) in your constructor anymore, the mixin defines an _events getter that does the magic for you.

emitter(Person.prototype);
var person = new Person();
person._events == person._events;
// > true
person._events == Person.prototype._events;
// > false

Tests

$ make test

License

(MIT)

Something went wrong with that request. Please try again.