News for hackers. Stuff that matters.
Re:YouTube artificially slows down video load times when usi... by Izkata on Monday November 20, 2023 @09:47AM (#38349043)
You can't directly do a sleep in Javascript because it runs in the same thread as the UI - it would block the user from interacting with the page. This is effectively a sleep because after 5 seconds it's running the code in the passed-in function (not firing an event). The code in the function then resolves a promise, which runs other functions that can be specified later by what called the one using setTimeout.

There are no comments on this comment yet.