async bootup to grab resources before beginning a process
npm install booteventQuickly describe async tasks needed to complete bootup.
Fluent js interface to acquire resources in lockstep before
considering a process to be booted.
npm install git://github.com/bewest/bootevent.git
javascript
var bootevent = require('bootevent');
`bootevent is a function which returns an api:It takes a
context which is passed around, and optionally takes a
booted function to be called when everything is ready.####
bootevent.acquireTakes an async function to run, use this to obtain a resource and
assign it to your context.
$3
`javascript
var bootevent = require('bootevent');
return bootevent( ).acquire(function db (ctx, next) {
console.log('context during acquiring db', ctx, arguments);
var now = new Date( );
console.log('starting acquire', arguments);
setTimeout(function done ( ) {
ctx.timeout = (new Date( )) - now;
console.log('simulated later', arguments);
next( );
}, 2000)
; })
.boot(function booted ( ) {
console.log('START PROCESS', arguments);
});
;
``
{ ctx: [Function],
tap: [Function],
acquire: [Function],
fail: [Function],
boot: [Function] }
context during acquiring db {} { '0': {}, '1': [Function] }
starting acquire { '0': {}, '1': [Function] }
simulated later {}
START PROCESS { '0': { timeout: 2001 } }`It's a "fluent" API so you can stack as many
acquire` calls calss as