An open API service indexing awesome lists of open source software.

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

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 !'));
```