diff options
| author | Kumar Priyansh <[email protected]> | 2018-09-09 08:19:27 +0530 |
|---|---|---|
| committer | Kumar Priyansh <[email protected]> | 2018-09-09 08:19:27 +0530 |
| commit | 5ef465dab66d20100630bba6a42f47c243aa476a (patch) | |
| tree | d95a1f961888d451733c947e42e56f49271f04be /src/service-worker.js | |
| download | NewsApp-5ef465dab66d20100630bba6a42f47c243aa476a.tar.xz NewsApp-5ef465dab66d20100630bba6a42f47c243aa476a.zip | |
Files Upload via GIT
Diffstat (limited to 'src/service-worker.js')
| -rw-r--r-- | src/service-worker.js | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/service-worker.js b/src/service-worker.js new file mode 100644 index 0000000..ffbbb06 --- /dev/null +++ b/src/service-worker.js @@ -0,0 +1,31 @@ +/** + * Check out https://googlechromelabs.github.io/sw-toolbox/ for + * more info on how to use sw-toolbox to custom configure your service worker. + */ + + +'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/vendor.js', + './build/main.css', + './build/polyfills.js', + 'index.html', + 'manifest.json' + ] +); + +// dynamically cache any other local assets +self.toolbox.router.any('/*', self.toolbox.fastest); + +// 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; |
