红联Linux门户
Linux帮助

提供完整的Promises实现 node-promise

发布时间:2013-12-30 10:48:01来源:红联作者:empast
node-promise 在 Node.js 平台上提供了完整的 Promises 的实现。

The node-promise module features a promise implementation with:

Chainable promises
Promises throw errors if an error handler is not provided
CommonJS promise proposal [1] compliant
Immutable once fulfilled to reduce possible side-effects
Promises can be used securely (as separate resolver/promise pairs in ocap situations)
Backwards compatibility where possible (addCallback, addErrback, emitSuccess, and emitError should still behave as expected)
Utility functions, including:

when() - Normalization of sync (normal values) and async (promises)
all() - Create a promise that accumulate multiple concurrent promises
first() - Find the first promise to be fulfilled in a group of promises
seq() - Sequentially execute a set of promise returning functions
delay() - Returns a promise that is fulfilled after a given amount of time
execute() - Executes a function that takes a callback and returns a promise (thank you Benjamin Thomas for providing this)

项目主页:https://github.com/kriszyp/node-promise

下载地址:https://github.com/kriszyp/node-promise/releases

来自:开源中国社区
文章评论

共有 0 条评论