https://github.com/dawee/ooo
Another async pattern for node, based on EventEmmitter
https://github.com/dawee/ooo
Last synced: 3 months ago
JSON representation
Another async pattern for node, based on EventEmmitter
- Host: GitHub
- URL: https://github.com/dawee/ooo
- Owner: dawee
- Created: 2013-10-08T20:48:55.000Z (almost 13 years ago)
- Default Branch: master
- Last Pushed: 2013-10-09T21:16:06.000Z (almost 13 years ago)
- Last Synced: 2025-01-26T01:24:21.436Z (over 1 year ago)
- Language: JavaScript
- Homepage:
- Size: 141 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# ooo
Another async pattern for node, based on EventEmmitter
## Installation
```bash
$ npm install ooo
```
## How to
### Basics
```js
// Bind an event
ooo('echo', console.log);
// Bind an event, juste once
ooo('echo!', function (msg) {
console.log(msg);
});
// Fire an event
ooo('echo')('Hello World !');
```
### Bridges
```js
var ooo = require('ooo');
var fs = require('fs');
ooo('file:read', function (err, data) {
console.log(data.toString());
});
fs.readFile('index.js', ooo('file:read'));
```
### Insert parameters
```js
var ooo = require('ooo');
var fs = require('fs');
ooo('file:read', function (msg1, err, data, msg2) {
console.log(msg1, data.toString(), msg2);
});
fs.readFile('index.js', ooo('file:read').before('Here is the file').after('Good bye !'));
```