Skip to content

Latest commit

 

History

History
38 lines (25 loc) · 607 Bytes

Readme.md

File metadata and controls

38 lines (25 loc) · 607 Bytes

My Promise

使用TypeScript写的符合 Promise/A+ 标准的 promise.

How to use

const promise = new Promise();

// Instance Methods
promise.then((resolve, reject)=>{
  resolve(value);
})

promise.catch((reason)=>{
  // deal with reason
})

// Static Methods:
Promise.resolve(value);

Promise.reject(reason);

Promise.race(promises);

Promise.all(promises);

How to test

yarn test

Refernence

Promise的源码实现(完美符合Promise/A+规范)

Saber2pr Promise