Created
December 18, 2017 22:02
-
-
Save patrickhulce/fd726acd1431b137941f1eff4fba1f2e to your computer and use it in GitHub Desktop.
See scheduling of callbacks/microtasks/tasks
This file contains hidden or 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.log('script start'); | |
setTimeout(function() { | |
console.log('setTimeout'); | |
}, 0); | |
// Edge/IE only | |
// setImmediate(function() { | |
// console.log('setImmediate'); | |
// }); | |
Promise.resolve().then(function() { | |
console.log('promise1'); | |
}).then(function() { | |
console.log('promise2'); | |
}); | |
console.log('script end'); | |
const evt = new Event('test') | |
const evtListener = () => console.log('click handler') | |
document.addEventListener('test', evtListener) | |
document.dispatchEvent(evt) | |
document.removeEventListener('test', evtListener) | |
})() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment