Skip to content

Instantly share code, notes, and snippets.

@185driver
Last active April 5, 2020 22:13
Show Gist options
  • Save 185driver/5356278346b7a8299e8cdc5050118f93 to your computer and use it in GitHub Desktop.
Save 185driver/5356278346b7a8299e8cdc5050118f93 to your computer and use it in GitHub Desktop.
// This is the code piece that GenerateSW mode can't provide for us.
// This code listens for the user's confirmation to update the app.
self.addEventListener('message', (e) => {
if (!e.data) {
return;
}
switch (e.data) {
case 'skipWaiting':
self.skipWaiting();
break;
default:
// NOOP
break;
}
});
workbox.core.clientsClaim(); // Vue CLI 4 and Workbox v4, else
// workbox.clientsClaim(); // Vue CLI 3 and Workbox v3.
// The precaching code provided by Workbox.
self.__precacheManifest = [].concat(self.__precacheManifest || []);
// workbox.precaching.suppressWarnings(); // Only used with Vue CLI 3 and Workbox v3.
workbox.precaching.precacheAndRoute(self.__precacheManifest, {});
@Renato66
Copy link

Renato66 commented Apr 5, 2020

/* eslint-disable no-undef, no-underscore-dangle, no-restricted-globals */
Missing eslint disable

@185driver
Copy link
Author

@Renato66 Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment