node-promise 在 Node.js 平台上提供了完整的 Promises 的实现。
The node-promise module features a promise implementation with:
Utility functions, including:
示例代码:
var Promise = require("promise").Promise; var promise = new Promise(); asyncOperation(function(){ Promise.resolve("succesful result"); }); promise -> given to the consumer