Created
March 14, 2022 14:32
-
-
Save shikelong/06ed03d68332d343c0c42c551374be5a to your computer and use it in GitHub Desktop.
Event Loop Test Codes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
console.group('output 🌿') | |
queueMicrotask(() => { | |
console.log('queueMicrotask') | |
}); | |
requestAnimationFrame(() => { | |
console.log('requestAnimationFrame') | |
}) | |
requestIdleCallback(() => { | |
console.log('requestIdleCallback') | |
}) | |
new Promise((res) => { | |
console.log('promise executor'); | |
res(100) | |
}).then((n) => { | |
console.log('promise call back: ', n) | |
}) | |
setTimeout(() => {console.log('setTimeout'); queueMicrotask(() => { | |
console.log('queueMicrotask2...') | |
})}, 0) | |
console.log('---sync----') | |
console.groupEnd('output 🌿') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment