Essential reading list for getting started with ServiceWorker
After our conversation with Tal Ater on episode #183 about the offline revolution and his experience with Service Workers, we realized there is a lot of mystery around this new browser feature. So we've put together this essential reading list for those of you looking for the best resources out there on ServiceWorker.
Service workers essentially act as proxy servers that sit between web applications, and the browser and network. They are intended to (amongst other things) enable the creation of effective offline experiences, intercepting network requests and taking appropriate action based on whether the network is available and updated assets reside on the server. They will also allow access to push notifications and background sync APIs. - #
Introduction to Service Workers
This was written early in the life of ServiceWorker from Matt Gaunt. Still relevant.
Rich offline experiences, periodic background syncs, push notifications— functionality that would normally require a native application—are coming to the web. Service workers provide the technical foundation that all these features will rely on.
Instant Loading Web Apps With An Application Shell Architecture
Addy Osmani & Matt Gaunt team up to share the low-down on using ServiceWorker to cache your UI shell and make repeat visits load instantly.
...gain substantial performance benefits thanks to intelligent service worker caching of your UI shell for repeat visits.
Cache-limiting in Service Workers
Jeremy Keith shared what he learned bloodying his knuckles with cache-limiting. Be sure to check out the ServiceWorker code he uses to speed up his blog by storing assets in a cache.
I've got a function in there called stashInCache that takes a few arguments: which cache to use, the maximum number of items that should be in there, the request (URL), and the response...
ServiceWorker Cookbook
You can also contribute to this growing cookbook on GitHub.
The Service Worker Cookbook is a collection of working, practical examples of using service workers in modern web apps.
Offline Recipes for Service Workers
David Walsh breaks down his recipe to create an app that can be used both online and offline with the help of a ServiceWorker.
The Offline Status recipe illustrates how to use a service worker to cache a known asset list and then notify the user that they may now go offline and use the app.
Service Workers: Dynamic Responsive Images using WebP Images
Dean Hume shows off code and commentary on how he uses Service Workers to intercept requests passed to the server to support additional image formats like WebP, and Internet Explorer's JPEGXR.
Service Workers open up a world of endless possibilities and this example could be extended to include other image formats and even caching. There's no reason why we can't present our users with fast web pages right now!
Service Workers Spec
This is the official spec published on GitHub but Alex Russell. The published version can found here, while the nightly version can be found here.
Service Worker API
This is an alternate, but not the canonical, spec on ServiceWorker. It's a little easier to read through, but YMMV.
Is ServiceWorker Ready?
Safari has given no public commitment, while Edge is under consideration, but showing positive signals. Like any good resource, it's on GitHub.
What about a part 2 with videos?
Yes, we have a follow-up post ready to post sharing our "Essential Watch List" on Service Workers so stay tuned. Subscribe to Changelog Weekly or follow us on Twitter to be notified.
If you know of an article or resource that needs to be listed here, let us know by opening an issue on GitHub.
Suggested
We encourage our readers to suggest additions for our list-based posts. The following were suggested from our Ping repo on GitHub.
- Nicolas Bevacqua's Making a Simple Site Work Offline with ServiceWorker
- The Guardian's Building an offline page for theguardian.com
Discussion
Sign in or Join to comment or subscribe