When.js 3.7.0 发布了,改进内容包括: Add process and window unhandled rejection events for cross-library debugging tools. Improve internal task queueing performance and memory usage. Stabilize handler ordering in the face of multiple promise implementations. When.js 是 cujojs 的轻量级的 Promises/A 和 when() 实现,从 wire.js 的异步核心和 cujojs 的 IOC 容器派生而来。包含很多其他有用的 Promiss 相关概念,例如联合多个 promiss、mapping 和减少 promises 集合以及 timed promises 等。 示例代码: var when = require('when'); var rest = require('rest'); when.reduce(when.map(getRemoteNumberList(), times10), sum) .done(function(result) { console.log(result); }); function getRemoteNumberList() { // Get a remote array [1, 2, 3, 4, 5] return rest('http://example.com/numbers').then(JSON.parse); } function sum(x, y) { return x + y; } function times10(x) {return x * 10; } 下载地址:https://github.com/cujojs/when/archive/3.7.0.zip When.js 3.7.0 发布,Promises/A 和 when() 实现下载地址