isSupported.ts 583 B

12345678910111213141516171819202122232425
  1. /*
  2. Copyright 2018 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. // Give TypeScript the correct global.
  9. declare let self: ServiceWorkerGlobalScope;
  10. /**
  11. * @return {boolean} Whether or not the current browser supports enabling
  12. * navigation preload.
  13. *
  14. * @memberof module:workbox-navigation-preload
  15. */
  16. function isSupported(): boolean {
  17. return Boolean(self.registration && self.registration.navigationPreload);
  18. }
  19. export {isSupported};