Last active
April 16, 2019 11:17
-
-
Save wilfrem/56a88ac99f850db4b170a799d45b54b7 to your computer and use it in GitHub Desktop.
microtask の検証コード(無限ループを引き起こす)
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
var callback; | |
var p = new Promise(resolve => callback = resolve); | |
var p2; | |
var microtask = () => { | |
console.log("microtask"); | |
p2.then(microtask); | |
}; | |
p2 = p.then(microtask); | |
console.log("sync"); | |
setTimeout(() => console.log("setTimeout")); | |
requestAnimationFrame(() => console.log("requestAnimationFrame")); | |
callback(); | |
console.log("sync2"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment