Service Worker Gotchas

Osvaldas Valutis from kollegorna.se has written an in-depth article on Service Workers

We’ve learned there quite a few gotchas to grasp in order to get Service Worker working correctly…

Comes with some solid advice and lots of code snippets.

One thing mentioned, that hadn’t crossed my mind before at all, is that it’s perfectly possible to “just” use ES2015 in your service worker:

It is completely safe to use the renewed JavaScript syntax in your serviceworker.js file, because browsers which support ES6 syntax also support Service Workers. However, I wouldn’t recommend using the new syntax for code that registers Service Worker, unless you use a transpiler.

Service Worker gotchas →

Related: Una Kravets’ writeup Implementing “Save For Offline” with Service Workers also forms a good start when it comes to Service Workers.

Published by Bramus!

Bramus is a frontend web developer from Belgium, working as a Chrome Developer Relations Engineer at Google. From the moment he discovered view-source at the age of 14 (way back in 1997), he fell in love with the web and has been tinkering with it ever since (more …)

Leave a comment

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.