-
Notifications
You must be signed in to change notification settings - Fork 3
/
worker.js
19 lines (16 loc) · 938 Bytes
/
worker.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
'use strict';
self.addEventListener('install', event => {
// The skipWaiting() method allows this service worker to progress from the registration's
// waiting position to active even while service worker clients are using the registration.
// https://slightlyoff.github.io/ServiceWorker/spec/service_worker/index.html#service-worker-global-scope-skipwaiting
event.waitUntil(self.skipWaiting());
});
self.addEventListener('activate', event => {
// The claim() method of the of the Clients interface allows an active Service Worker to set
// itself as the active worker for a client page when the worker and the page are in the same
// scope. This triggers an oncontrollerchange event on any client pages within the Service
// Worker's scope.
// https://slightlyoff.github.io/ServiceWorker/spec/service_worker/index.html#clients-claim-method
event.waitUntil(self.clients.claim());
});
self.importScripts('main.js');