4 ms·
If you do too much work at once on the main thread, the application will visibly freeze. Say you need to call a few rest apis that trigger changes to the DOM.
by jasonjmcghee 4y ago
If you do too much work at once on the main thread, the application will visibly freeze.
Say you need to call a few rest apis that trigger changes to the DOM. If the user is actively interacting with your application, doing an operation like this, say every 5 seconds, could cause momentary lag that feels bad. What if you could wait to do the update until the main thread is free?
- collaborative 4y agoQuestion.. is this using multiple threads? If it isn't, how is this different than async operations?
- remram 4y agoIt is async, the operation is delayed until the processor has nothing important to do.
- remram 4y agoMaking changes to the DOM seconds later is the part I don't get. Either it's part of interaction and therefore it's urgent, or it's... what?
- sheusndudn 4y ago
- leipert 4y agoAt work we have these time strings, e.g. “2 min ago”. We show a tooltip when the user hovers over them. We can defer the initialization of the “show-tooltip” logic because surely those tooltips are less important than other things on the page. Same with links to user profiles.