In this activity you will set up serviuce worker functionality to allow your application to work offline.
-
We will be using a
kind of a live coding exercise
for this activity -
Add the following code to your
service-worker.js
file. -
Type out the following code snippets from each of the images when adding them to your application. This will permit you to work at your own pace!
-
As you go through each step, keep your Chrome Develop tools open to monitor your progress and debug if needed.
- Set Up Cache Files
- Install and Register Your Service Worker
- If done successfully, you should see your static cache in your Application tab.
- Activate Service Worker
- Fetch Files
If done successfully you will see your data cache in your Application tab. At this point you should be able to put your application in offline mode for an offline experience.