What nodejs library is most like jQuery's deferreds?

前端 未结 7 1929
失恋的感觉
失恋的感觉 2020-12-05 13:54

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

相关标签:
7条回答
  • 2020-12-05 14:10

    This nodejs module is CommonJS compliant.

    https://github.com/cujojs/when

    0 讨论(0)
  • 2020-12-05 14:21

    This node library looks quite similar in functionality to jQuery's Deferred:

    https://github.com/kriszyp/node-promise

    0 讨论(0)
  • 2020-12-05 14:23

    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();
    
    0 讨论(0)
  • 2020-12-05 14:24

    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...

    • https://github.com/willconant/flow-js
    • https://github.com/creationix/conductor

    Both of which are probably much closer to what you are looking for. :)

    0 讨论(0)
  • 2020-12-05 14:28

    I don't think you can get any closer than jQuery deferred lib for nodeJS.

    0 讨论(0)
  • 2020-12-05 14:28

    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

    0 讨论(0)
提交回复
热议问题