I have a resource consuming DOM (browser) related JavaScript process. When started it blocks the page (other DOM related processed). Is it possible to run this process in parallel asynchronously, and when it finished pass the result to main page? Web workers is not the case, as process works with DOM.
Can this be implemented with iframes? Does JS started in iframe block hosted page DOM too?
Actually it would be a prime example for using WebWorkers, but as you correctly mentioned you won’t have a reference to a DOM there. Your only option is to decouple that process into smaller task’s. If you can do that, you need to ask yourself two questions
If you can answer both questions with No, you can setup a run-away script timer and execute those tasks asynchronously. Example:
The above algorythm would execute the functions contained by
taskListas fast as possible, but within a time-frame of 100ms max. This will ensure that the browser respectively the UI thread won’t get blocked for longer than 100ms during the processing. Hence the browser will stay responsive.