AsyncBox
AsyncBox is a library for your main application
object, it supports Sync and Async APIs
App object provides own API plus evented EventEmitter
API
Usage:
var AsyncBox = require('async-box');
var app = new AsyncBox();
app.respondAsync('some-request-name', function(requestData) {
return 'response-text';
});
app.respondAsync('async-promise-request', function(requestData) {
return new Promise(function(resolve, reject) {
resolve('response-promise');
});
});
app.requestAsync('some-request-name').then(function(response) {
console.log(response);
});
app.requestAsync('async-promise-request').then(function(response) {
console.log(response);
});
TODO: Batch API example
TODO: Sync API example