Building a JavaScript Promise from Scratch
1–2 of 2 posts
Re: Building a JavaScript Promise from Scratch
#2There is a subtle issue here: all parts of the suggested promise implementation run synchronously.
In spec-compliant promises, the executor runs synchronously [1][2], but the promise must wait until the next turn of the event loop [3] before calling the 'then' method.
[1] https://stackoverflow.com/questions/36726890/why-are-javascr...
[2] https://stackoverflow.com/questions/36932244/what-is-the-int...
[3] https://github.com/promises-aplus/promises-spec/issues/68