Skip to content

Commit ff6498c

Browse files
authored
ezClip v0.3.0
ezClip v0.3.0
1 parent c110c3c commit ff6498c

1 file changed

Lines changed: 25 additions & 0 deletions

File tree

sw.js

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
var cacheName = 'ezclip-pwa';
2+
var filesToCache = [
3+
'./',
4+
'./index.html',
5+
'./ezclip.js',
6+
'./ezclip_bg.wasm',
7+
];
8+
9+
/* Start the service worker and cache all of the app's content */
10+
self.addEventListener('install', function (e) {
11+
e.waitUntil(
12+
caches.open(cacheName).then(function (cache) {
13+
return cache.addAll(filesToCache);
14+
})
15+
);
16+
});
17+
18+
/* Serve cached content when offline */
19+
self.addEventListener('fetch', function (e) {
20+
e.respondWith(
21+
caches.match(e.request).then(function (response) {
22+
return response || fetch(e.request);
23+
})
24+
);
25+
});

0 commit comments

Comments
 (0)