Skip to content

Instantly share code, notes, and snippets.

@wilfrem
Last active April 16, 2019 11:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wilfrem/56a88ac99f850db4b170a799d45b54b7 to your computer and use it in GitHub Desktop.
Save wilfrem/56a88ac99f850db4b170a799d45b54b7 to your computer and use it in GitHub Desktop.
microtask の検証コード(無限ループを引き起こす)
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