skipWaiting.mjs 605 B

12345678910111213141516171819202122
  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.mjs';
  8. /**
  9. * Force a service worker to become active, instead of waiting. This is
  10. * normally used in conjunction with `clientsClaim()`.
  11. *
  12. * @alias workbox.core.skipWaiting
  13. */
  14. export const skipWaiting = () => {
  15. // We need to explicitly call `self.skipWaiting()` here because we're
  16. // shadowing `skipWaiting` with this local function.
  17. addEventListener('install', () => self.skipWaiting());
  18. };