commit | author | age
|
a5a648
|
1 |
/** |
W |
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 |
'use strict'; |
|
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/vendor.js', |
|
19 |
'./build/main.css', |
|
20 |
'./build/polyfills.js', |
|
21 |
'index.html', |
|
22 |
'manifest.json' |
|
23 |
] |
|
24 |
); |
|
25 |
|
|
26 |
// dynamically cache any other local assets |
|
27 |
self.toolbox.router.any('/*', self.toolbox.cacheFirst); |
|
28 |
|
|
29 |
// for any other requests go to the network, cache, |
|
30 |
// and then only use that cached resource if your user goes offline |
|
31 |
self.toolbox.router.default = self.toolbox.networkFirst; |