asyncify
The asyncify deferred module of FuturesJS (Ender.JS and Node.JS)
Last updated 13 years ago by coolaj86 .
Repository · Bugs · Original npm · Tarball · package.json
$ npm install asyncify 
SYNC missed versions from official npm registry.

asyncify()

  • doStuff = Futures.asyncify(doStuffSync) - returns a fuction with the same signature which catches errors and returns a future rather than the synchronous data.

Example:

function doStuffSync = function (params) {
  throw new Error("Error of some sort");
  return "Hello";
}

var doStuff = Futures.asyncify(doStuffSync);

doStuff.whenever(function (err, data) {
  console.log(err, data);
});

doStuff();
doStuff();
doStuff().when(function (err, data) {
  if (err) {
    throw err;
  }
  console.log(data);
});

Current Tags

  • 2.1.2                                ...           latest (13 years ago)

2 Versions

  • 2.1.2                                ...           13 years ago
  • 2.1.1                                ...           15 years ago
Maintainers (1)
Downloads
Total 5
Today 0
This Week 0
This Month 3
Last Day 0
Last Week 1
Last Month 0
Dependencies (1)
Dev Dependencies (0)
None
Dependents (1)

© 2010 - cnpmjs.org x YWFE | Home | YWFE