Advantages of Web Workers and how they were achieved before?

I have read about Web Workers on and I think I understand their purpose, but I am wondering if one of the main purposes of web workers, namely “allows long tasks to be executed without yielding to keep the page responsive.” could be already achieved without web workers?
Like Registering Callbaks also allow long tasks to be executed, and only interrupt when they are ready, wtihout blocking, isn’t that the same?


Callbacks allow you to manage concurrency. That is handling tasks. Not always in an easy way.

Not only do webworkers allow you to do concurrency in an easier way, they also let you have parallelism, that is tasks really running in parallel : they don’t necessarily block each other and they don’t block the UI.

In order to have a long javascript based running task in your browser before web worker, you had to micro-manage it to cut it in small parts in order to allow the UI to keep responsive. And of course having more than one long running task was more complex.

Leave a Reply

Your email address will not be published. Required fields are marked *