2.0.5 • Published 5 years ago

eventemitter-co v2.0.5

Weekly downloads
17
License
ISC
Repository
github
Last release
5 years ago

eventemitter with generator support (through co). eventemitter-co mimics require('events').EventEmitter API.

Build Status Coverage Status Version License

API

var sleep = require('nyks/function/sleep');

var Event = require('eventemitter-co');
var event = new Event();

var cafe = {color:'black'};
event.on("start", function*() {
  yield sleep(1);
  console.log("Hi, coffee is ", this.color);
}, cafe);


event.emit("start");

Errors (&promises)

event.emit() will return a promise you can work with if you need to handle errors

Notes

You can set an optional 3rd parameter and set the context ("this") in event registration.

Credits

  • 131
  • tj/co
  • uclass a pure JS/browser compliant class design syntax (ES6 classes with bindings)

Keywords / shout box

events, eventemitter2, co, generators, promise, binding

2.0.5

5 years ago

2.0.3

6 years ago

1.0.5

7 years ago

1.0.4

8 years ago

1.0.3

8 years ago

1.0.2

8 years ago

1.0.1

8 years ago