forked from asis2016/bootstrap-5-admin-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
sw.js
34 lines (31 loc) · 860 Bytes
/
sw.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
let APP = 'MDUB Form';
let ASSETS = [
'./',
'./index.html',
'./static/css/bootstrap.min.css',
'./static/css/jquery-jvectormap-2.0.5.css',
'./static/css/style.css',
'./static/js/dashboard.js',
'./static/js/expenses.js',
'./static/js/sales.js',
'./static/js/script.js',
'./static/js/jquery-jvectormap-2.0.5.min.js',
'./static/js/jquery-jvectormap-world-mill-en.js',
'./static/js/user-demographics.js',
]
/**
* Start the service and cache ASSETS.
*/
self.addEventListener('install', installEvent => {
installEvent.waitUntil(caches.open(APP).then(cache => {
cache.addAll(ASSETS)
}))
});
/**
* For offline mode
*/
self.addEventListener("fetch", fetchEvent => {
fetchEvent.respondWith(caches.match(fetchEvent.request).then(res => {
return res || fetch(fetchEvent.request)
}))
});