by codedokode · 8y ago · 0 comments
This all happens synchronously, although deferred, but still can block the app completely if someone is simply wrapping synchronous actions in Promises expecting them to be "async".
(async () => {
setImmediate(function() {
console.log("4");
});
setTimeout(function() {
console.log("3");
}, 0);
console.log(await new Promise((resolve, reject) => {
console.log("0");
resolve("2");
}));
})().catch();
console.log("1");