/ programming

About Service Workers

  • Support an offline experience YEAH!
  • Do tasks in the background
  • Push notifications
  • Background sync e.g. progressive web apps (PWA), caching, indexedDB

Eh? What about memory usage and bloated apps?

The browser handles memory management and heavy service workers.

A bit of history

AppCache came before the 'service worker' concept, but it had issues with cache invalidation and basically came as part a time when everyone was stilling working out how to do native-like experiences on the web. For a while it was worrying because it looks like cross browser compatibility was going backwards again (Google Gears, Chrome-only Web apps with a Chrome-only compatible manifest file- not to be confused with service worker manifest files found in AppCache solutions).

Like jscipt / javascript 'wars' of the past the web consortium's appear to be much more collaborative now for the 'greater good' of the web, which has lead to much better interoperability. These things take time. Non-interoperability is part of life when these things are being worked out. Thankfully service workers are a product of this painful experimentation.

How to register a service worker basic example

The Mozila Developer Network (mdn) provides a great getting started with using Service Workers tutorial.