How to update service worker cache in PWA? : <p>I use service worker with <a href="https://github.com/GoogleChrome/sw-toolbox" rel="noreferrer">sw-toolbox</a> library. My PWA caches everything except API queries (images, css, js, html). But what if some files will be changed someday. Or what if service-worker.js will be changed.
How application should know about changes in files?</p>

<p>My service-worker.js:</p>

<pre><code>'use strict';
importScripts('./build/sw-toolbox.js');

self.toolbox.options.cache = {
  name: 'ionic-cache'
};

// pre-cache our key assets
self.toolbox.precache(
  [
    './build/main.js',
    './build/main.css',
    './build/polyfills.js',
    'index.html',
    'manifest.json'
  ]
);

// dynamically cache any other local assets
self.toolbox.router.any('/*', self.toolbox.cacheFirst);

// for any other requests go to the network, cache,
// and then only use that cached resource if your user goes offline
self.toolbox.router.default = self.toolbox.networkFirst;
</code></pre>

<p>I don't know what is the usual method to update cache in PWA. Maybe PWA should send AJAX request in background and check UI version?</p>
