To work better with the user, I use setTimeout a lot, so working in the background can happen as much as possible.
On Windows, it looks like everything is working on the main event flow. It is more effort to make the application disconnect from this thread, but in the end the user will have a better experience.
The only thing that may go wrong is that if you have a variable change before it is actually used in setTimeout, the action may be different.
Thus, you can at least know about it if you see strange behavior. Ideally, your design should not allow, but it can happen.
source share