Build callback chains without ridiculous indentation!
JavaScript
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
test
.travis.yml
README.md
chainer.js
example.js
index.js
package.json

README.md

build status

var chainer = require('chainer');

// Make a new chain.
var chain = chainer();

// Add callbacks to chain.
chain.add(function(){
    console.log('First!');
    chain.next();
}); 
chain.add(function(){
    console.log('Second!');
});

chain.add(function hi() {
    console.log('hi');
});

chain.add('hello', function() {
    console.log('hello');
});

// Run chain.
chain.run();

// Run some explicit function
chain.fn.hi();
chain.fn.hello();