Minimal viable service worker

Jeremy, with the help of Jake, has developed a MVP for the service worker. It allows HTML to always be requested from the server, and if there’s an issue it goes to the cache (and adds a new version to the cache each time it visits the network version). It does the same for files, but goes to the cache first before then going to the network if it can’t be found (and even if it is, it goes to the network to refresh the file version). Pretty nifty really, you should trial it out and feedback to Jeremy with any issues or recommendations.

(if you like the sound of this I covered it on the podcast in episode 68)

Jeremy Keith - Adactio site screenshot

My original attempt was riddled with errors. Jake came to my rescue and we revised the script into something that actually worked. In the process, my misunderstanding of how await works led Jake to write a great blog post on await vs return vs return await.

An excerpt from Minimal viable service worker

View original article

Subscribe to our Newsletter

Add your email address and receive an email every Friday covering off everything worth knowing about building your websites responsively.