skipWaiting.js 695 B

123456789101112131415161718192021
  1. /*
  2. Copyright 2019 Google LLC
  3. Use of this source code is governed by an MIT-style
  4. license that can be found in the LICENSE file or at
  5. https://opensource.org/licenses/MIT.
  6. */
  7. import './_version.js';
  8. /**
  9. * Force a service worker to activate immediately, instead of
  10. * [waiting](https://developers.google.com/web/fundamentals/primers/service-workers/lifecycle#waiting)
  11. * for existing clients to close.
  12. *
  13. * @memberof module:workbox-core
  14. */
  15. function skipWaiting() {
  16. // We need to explicitly call `self.skipWaiting()` here because we're
  17. // shadowing `skipWaiting` with this local function.
  18. self.addEventListener('install', () => self.skipWaiting());
  19. }
  20. export { skipWaiting };