I\'ve become a skilled user of jQuery\'s new and amazing Deferred module, and as I\'m easing into using more of Node.js, I find myself wanting something exactly like it in m
This nodejs module is CommonJS compliant.
https://github.com/cujojs/when
This node library looks quite similar in functionality to jQuery's Deferred:
https://github.com/kriszyp/node-promise
If you want the same API, there's nothing stopping you from using jQuery itself under Node. Just npm install jquery
, then:
var $ = require('jquery');
var deferred = $.Deferred();
Googling: deferred for nodejs
Gave me: https://github.com/felixge/node-deferred
Though not exactly what you are looking for, is moderately close. I find that the callback chaining is fairly natural, though deeply nested chains can be a bit difficult to keep up with.
Searching for: promise nodejs lead me down a path of more interesting results...
Both of which are probably much closer to what you are looking for. :)
I don't think you can get any closer than jQuery deferred lib for nodeJS.
This wasn't around when the question was asked, but according to the readme it uses (and passes) the jquery tests. It appears to be exactly identical minus the (jQuery||$). prefix.
https://github.com/jaubourg/jquery-deferred-for-node