Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> All IO in JS is async, you either have a Promise-based API (which can be sugared with await) or callbacks.

No it's not. There are all kind of *Sync functions even in nodejs and in browsers (there was sync variant of XHR), and JS engine generally doesn't care if you block in your functions or not. JS engines don't even have an event loop, that's just a construct within the app that uses the engine, like nodejs or whatever.



In this case it's probably fine to block, but in most others it's absolutely not.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: