blob: 48f7b930731ae8de8a8cf87b4996ff197c3f96cd (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
self.addEventListener("install", function(event) {
event.waitUntil(caches.open("cache").then(function(cache) {
return cache.add("index.html");
}));
});
self.addEventListener("fetch", function(event) {
if (event.request.url.indexOf("index.html") >= 0) {
event.respondWith(new Promise(function(resolve, reject) {
caches.match(event.request).then(function(response) {
resolve(response.clone());
});
}));
}
});
|