Skip to content

Commit cfb7492

Browse files
committed
new build for codelabs
1 parent a81a57e commit cfb7492

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

src/step-4/ServiceWorker.js

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,19 @@ self.addEventListener('install', function (event) {
4141
console.log('Event: Install');
4242
4343
// waitUntil method extends the lifetime of an event
44-
event.waitUntil(
45-
//Add the files to cache here
44+
event.waitUntil(
45+
//Open the cache
46+
caches.open(cacheName)
47+
.then(function (cache) {
48+
//Adding the files to cache
49+
return cache.addAll(filesToCache)
50+
.then(function () {
51+
console.log("All files are cached.");
52+
})
53+
})
54+
.catch(function (err) {
55+
console.log("Error occurred while caching ", err);
56+
})
4657
);
4758
});`;
4859

0 commit comments

Comments
 (0)