Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/segment-boneyard/co-event
Consume events from an event emitter in generators
https://github.com/segment-boneyard/co-event
Last synced: about 5 hours ago
JSON representation
Consume events from an event emitter in generators
- Host: GitHub
- URL: https://github.com/segment-boneyard/co-event
- Owner: segment-boneyard
- Created: 2014-03-18T21:36:03.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2014-03-18T21:46:36.000Z (over 10 years ago)
- Last Synced: 2024-10-28T15:59:28.246Z (18 days ago)
- Language: JavaScript
- Size: 121 KB
- Stars: 14
- Watchers: 40
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: Readme.md
- Changelog: History.md
Awesome Lists containing this project
README
# co-event
Return any event that an emitter emits.
## Installation
```
$ npm install co-event
```## Example
Returns events in sequence, with the `.type` and `.args` keys. The original events are still emitted except for "error", as node will think no handler is registered.
```js
var event = require('co-event');var e;
while (e = yield event(emitter)) {
switch (e.type) {
case 'end':
break;case 'close':
break;case 'error':
break;
}
}
```# License
MIT