1 | /**
|
2 | * Check out https://googlechrome.github.io/sw-toolbox/ for
|
3 | * more info on how to use sw-toolbox to custom configure your service worker.
|
4 | */
|
5 |
|
6 |
|
7 | ;
|
8 | importScripts('./build/sw-toolbox.js');
|
9 |
|
10 | self.toolbox.options.cache = {
|
11 | name: 'ionic-cache'
|
12 | };
|
13 |
|
14 | // pre-cache our key assets
|
15 | self.toolbox.precache(
|
16 | [
|
17 | './build/main.js',
|
18 | './build/main.css',
|
19 | './build/polyfills.js',
|
20 | 'index.html',
|
21 | 'manifest.json'
|
22 | ]
|
23 | );
|
24 |
|
25 | // dynamically cache any other local assets
|
26 | self.toolbox.router.any('/*', self.toolbox.cacheFirst);
|
27 |
|
28 | // for any other requests go to the network, cache,
|
29 | // and then only use that cached resource if your user goes offline
|
30 | self.toolbox.router.default = self.toolbox.networkFirst;
|