Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

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

install

npm i tmpvar-future

Downloadsweekly downloads

2

version

1.2.1

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability