@0x2e757/promise-ext 中文文档教程
PromiseExt
可以取消的轻量级原生承诺包装器。 不依赖于其他库。
转译为 ES2015 JavaScript 的 TypeScript 代码。
Install
npm i @0x2e757/promise-ext
Usage
新类 PromiseExt
大部分将与常规 Promise
一样使用。
How to import
import PromiseExt from "@0x2e757/promise-ext";
Unique methods
timeout
— 使用 setTimeout
包装解析器;
cancel
— 阻止 promise 或其链式操作执行的函数;
Unique static functions
wrap
— 为提供的承诺创建包装器;
* all
函数将取消所有可取消的承诺,如果其中任何一个失败的话。
PromiseExt
Lightweight native promise wrapper that can be cancelled. Has no dependencies on other libraries.
TypeScript code transpiled to ES2015 JavaScript.
Install
npm i @0x2e757/promise-ext
Usage
New class PromiseExt
mostly will by used same as regular Promise
.
How to import
import PromiseExt from "@0x2e757/promise-ext";
Unique methods
timeout
— wrapper around resolver using setTimeout
;
cancel
— function for preventing promise or its chain actions execution;
Unique static functions
wrap
— creates wrapper for provided promise;
* all
function will cancel all cancellable promises if any of them will fail.