Message from JavaScript talks

April 2017

— When the succeding call stack finishes the then method executes, I see

— 

I see it is because for that next tick the promise method switches context back to the main call stack flow. If you dont have something there in the next tick the method runs right away

— Sadly though this is not affected by closures :p

— You know how to implement a blocking sleep(ms)?

— Yes

— (not that you would want to)

— I made this test

Promise.resolve().then(() => fs.readFileSync('./Vines.mp4')).then(() => console.log('finished')); 
console.log('Lmao');
process.nextTick(() => {
console.log('next tick');
process.nextTick(() => console.log('next tick after that'))
})


And throws
Lmao
next tick
next tick after that
finished

Message permanent page

— It's still blocking dude

— Sync calls freeze the process

— If its blocking the result doesnt have to be

Lmao

next tick

finished

next tick after that

?

— What?

— No