Skip to content

learning ecma262 and try to make a polyfill for myself

Notifications You must be signed in to change notification settings

JamieMaple/ecma262-promise

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Promise

A+

https://promisesaplus.com/

ES6

PS:从 LearningNotes 的造轮子分支中单独分离出来的仓库。。。

网上 A+ 栗子非常多,但为了尝试学院派的风格,故遵守标准造造轮子

promise 读规范有感

顺便也非常感谢组长麦冬学长分享的 repo 启发

读完 Promise 的标准觉得实现非常严谨 感觉类型系统可能更有助于理解 Promise 也更有助于编译检测,所以想用 ts 造 Promise 的轮子

// constructor
Promise

// methods
Promise.prototype.then
Promise.prototype.catch
// finally - stage4 it
Promise.prototype.finally

// static methods
Promise.resolve
Promise.reject

// TODO
// all, race

http://www.ecma-international.org/ecma-262/6.0/ECMA-262.pdf

https://tc39.github.io/proposal-promise-finally/

PS:果然我的代码水平依然很烂

MIT

About

learning ecma262 and try to make a polyfill for myself

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published