node-promise

码农软件 · 软件分类 · Node.js 扩展 · 2019-04-16 15:57:30

软件介绍

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)

示例代码:

var Promise = require("promise").Promise;
var promise = new Promise();
asyncOperation(function(){
  Promise.resolve("succesful result");
});
promise -> given to the consumer

本文地址:https://www.codercto.com/soft/d/3716.html

破壁书

破壁书

邵燕君 主编、王玉玊 副主编 / 生活•读书•新知三联书店 生活书店出版有限公司 / 2018-6-1 / 88.00

*一本神奇的网络文化辞典,解读二次元、宅文化、网文、游戏、流行文化,让人大开眼界; *245个网络文化核心关键词,追本溯源,讲述背后文化演变与有趣故事,读来恍然大悟,知其然,更知其所以然; *北大中文系学术团队数年研究成果,曹文轩、韩少功、李敬泽、猫腻顾问推荐,三联生活书店花3年倾力打造; *百度 查不到、词条不过时、形式新颖丰富、文章可读性强、学术上经得起推敲,五大特点打造权威......一起来看看 《破壁书》 这本书的介绍吧!

JS 压缩/解压工具
JS 压缩/解压工具

在线压缩/解压 JS 代码

在线进制转换器
在线进制转换器

各进制数互转换器

HTML 编码/解码
HTML 编码/解码

HTML 编码/解码