Skip to content

Instantly share code, notes, and snippets.

@crongro
Created July 16, 2018 12:23
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 crongro/b8ab8f5fa6d8f8960500b9ea60178026 to your computer and use it in GitHub Desktop.
Save crongro/b8ab8f5fa6d8f8960500b9ea60178026 to your computer and use it in GitHub Desktop.
async_order
console.log('script start');
requestAnimationFrame(()=> {
console.log("requestanimationframe");
})
const interval = setInterval(() => {
console.log('setInterval')
}, 0)
setTimeout(function () {
console.log('setTimeout 1');
}, 0);
Promise.resolve().then(function () {
console.log('promise1');
}).then(function () {
setTimeout(() => {
console.log('setTimeout 2')
Promise.resolve().then(() => {
console.log('promise 2')
}).then(() => {
console.log('promise 3')
}).then(() => {
clearInterval(interval)
})
}, 0)
});
setTimeout(function () {
console.log('setTimeout 3');
}, 0);
Promise.resolve().then(function () {
console.log('promise4');
}).then(function () {
console.log('promise5');
});
console.log('script end');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment