3 ms·
You don't have access to the DOM with Web Workers but you can still perform an AJAX request and load in the data without disrupting the thread that renders the
by rajangdavis 11y ago
You don't have access to the DOM with Web Workers but you can still perform an AJAX request and load in the data without disrupting the thread that renders the HTML. I highly recommend checking out the Pokedex progressive Web app for such a use case.
I use it on the first page load so that I can get all of the data I need for most of the routing upfront so that I don't need to perform an AJAX request for every state change. I was originally having the server render JSON inline with HTML but Web Workers ended up being faster.