tmpvar-future

1.2.1 • Public • Published

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!

license

MIT

Package Sidebar

Install

npm i tmpvar-future

Weekly Downloads

1

Version

1.2.1

License

MIT

Last publish

Collaborators

  • tmpvar