-
Promise.resolve().then(function () {
console.log(0);
return Promise.resolve(4);
}).then(function (r) {
console.log(r);
})
Promise.resolve().then(function () {
console.log(1);
}).then(function () {
console.log(2);
}).then(function () {
console.log(3);
}).then(function () {
console.log(5);
}) All 1, 2, 3, 5 's callback are |
Beta Was this translation helpful? Give feedback.
Answered by
devsnek
Oct 29, 2020
Replies: 1 comment
-
I patched https://engine262.js.org to print when a function is pushed to the microtask queue, and when the resolve function from a promise constructor is called, by which i mean Promise.resolve('p0')
.then(function h0() {
console.log(0);
return Promise.resolve(4);
})
.then(function h1(r) {
console.log(r);
return 'h2ret';
});
Promise.resolve('p1')
.then(function h2() {
console.log(1);
return 'h2ret';
})
.then(function h3() {
console.log(2);
return 'h3ret';
})
.then(function h4() {
console.log(3);
return 'h4ret';
})
.then(function h5() {
console.log(5);
return 'h5ret';
});
|
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
pikadun
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I patched https://engine262.js.org to print when a function is pushed to the microtask queue, and when the resolve function from a promise constructor is called, by which i mean
new Promise((resolve) => { resolve(5) })
, notPromise.resolve(5)
.