Skip to content
Another async pattern for node, based on EventEmmitter
JavaScript
Find file
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
README.md
index.js
package.json

README.md

ooo

Another async pattern for node, based on EventEmmitter

Installation

$ npm install ooo

How to

Basics

// 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

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

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 !'));
Something went wrong with that request. Please try again.