News for hackers. Stuff that matters.
Re:What Color is Your Function? (2015) by sakex on Thursday October 24, 2024 @06:51AM (#41934226)
There is no preemption in Javascript. It is based on cooperative multitasking[1] (your await statements and non-blocking callback) which is the opposite of preemption.

[1]https://en.wikipedia.org/wiki/Cooperative_multitasking#:~:te....

Re:What Color is Your Function? (2015) by ndndjdueej on Thursday October 24, 2024 @07:53AM (#41934627)
As anyone who has done the old setTimeout(fn, 0) trick in the browser probably knows.
Re:What Color is Your Function? (2015) by Feathercrown on Thursday October 24, 2024 @09:24AM (#41935238)
They even created setImmediate(fn) for this purpose
Re:What Color is Your Function? (2015) by orlp on Thursday October 24, 2024 @12:22PM (#41936990)
If every line had an implicit await then it is indistinguishable from pre-emption, which I think is the point the person you're replying to is trying to make.