Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F120823878
serviceworker.js
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Authored By
Unknown
Size
1 KB
Referenced Files
None
Subscribers
None
serviceworker.js
View Options
var
staticCacheName
=
"kolab-v1"
;
var
filesToCache
=
[
'/offline'
,
// '/css/app.css',
// '/js/app.js',
'/images/icons/icon-72x72.png'
,
'/images/icons/icon-96x96.png'
,
'/images/icons/icon-128x128.png'
,
'/images/icons/icon-144x144.png'
,
'/images/icons/icon-152x152.png'
,
'/images/icons/icon-192x192.png'
,
'/images/icons/icon-384x384.png'
,
'/images/icons/icon-512x512.png'
,
'/images/logo.svg'
,
];
// Cache on install
self
.
addEventListener
(
"install"
,
event
=>
{
this
.
skipWaiting
();
event
.
waitUntil
(
caches
.
open
(
staticCacheName
)
.
then
(
cache
=>
{
return
cache
.
addAll
(
filesToCache
);
})
)
});
// Clear cache on activate
self
.
addEventListener
(
'activate'
,
event
=>
{
event
.
waitUntil
(
caches
.
keys
().
then
(
cacheNames
=>
{
return
Promise
.
all
(
cacheNames
.
filter
(
cacheName
=>
(
cacheName
.
startsWith
(
"kolab-"
)))
.
filter
(
cacheName
=>
(
cacheName
!==
staticCacheName
))
.
map
(
cacheName
=>
caches
.
delete
(
cacheName
))
);
})
);
});
// Serve from Cache
self
.
addEventListener
(
"fetch"
,
event
=>
{
event
.
respondWith
(
caches
.
match
(
event
.
request
)
.
then
(
response
=>
{
return
response
||
fetch
(
event
.
request
);
})
.
catch
(()
=>
{
return
caches
.
match
(
'offline'
);
})
)
});
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Apr 24, 10:13 AM (3 d, 2 h ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
1e/e9/06d1d334611af6e881f0f1c6721d
Default Alt Text
serviceworker.js (1 KB)
Attached To
Mode
rK kolab
Attached
Detach File
Event Timeline