Socket
Socket
Sign inDemoInstall

emitter-mixin

Package Overview
Dependencies
0
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    emitter-mixin

Node's EventEmitter mixin


Version published
Weekly downloads
25K
decreased by-7.87%
Maintainers
1
Install size
6.78 kB
Created
Weekly downloads
 

Readme

Source

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)

Keywords

FAQs

Last updated on 11 Nov 2012

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc