Skip to content

Latest commit

 

History

History
30 lines (22 loc) · 737 Bytes

README.md

File metadata and controls

30 lines (22 loc) · 737 Bytes

understanding-promise

Promises/A+ logo An easy-to-understand version of Promise/A+ implementation

结合各种“手写Promise文章”的一个符合Promise/A+规范的实现,仅供学习使用


test

yarn
yarn test

实现内容

符合Promise/A+规范的实现

构造函数包含 resolve 一个 Thenable 对象的处理

Promise/A+规范中并没有对Promise构造函数的要求,现有的文章基本都没有处理

其他API

  • Promise.prototype.catch()
  • Promise.race()
  • Promise.all()
  • Promise.allSettled()