1.2.1 • Published 10 years ago
tmpvar-future v1.2.1
tmpvar-future
A stupid simple way to pass around continuations and treat them like real values until they have resolved.
install
npm install tmpvar-future
use
var future = require('tmpvar-future');
// create a future
var f = future();
// setup an observer for when this future
// evaluates or errors
f(function(e, r) {
// do something with e/r
});
// resolve
f(null, 1);
// late binding
setTimeout(function() {
f(funtion(e, r) {
console.log(r); // outputs: 1
});
}, 100);
that is it!