2 ms·
To an extent yes, but consider the context: front end scripting The javascript threading model is that there is a single thread executing so within a given bit
by recursivedoubts 5y ago
To an extent yes, but consider the context: front end scripting
The javascript threading model is that there is a single thread executing so within a given bit of code you can be reasonably sure things are safe. The hyperscript runtime only allows one instance of a given event handler to execute at a time (unless otherwise specified) so the primary source of concurrency issues (the same code executing concurrently) is typically not an issue. By structuring your code such that it is on the same element (perhaps triggered by events elsewhere) you can effectively synchronize code in an intuitive manner.
I certainly wouldn't recommend the language for the back end though!
- Yoric 5y agoMy team just spent three weeks hunting down a race condition in JavaScript integration tests. Turns out it was a missing `await`. So, I wouldn't claim that JavaScript is anywhere near safe :) Admittedly, this was back-end, so it's possible that the situation is simpler in the front-end. Good luck with your project!