sw.js 785 B

123456789101112131415161718192021222324252627
  1. // NOTICE!! DO NOT USE ANY OF THIS JAVASCRIPT
  2. // IT'S ALL JUST JUNK FOR OUR DOCS!
  3. // ++++++++++++++++++++++++++++++++++++++++++
  4. (function () {
  5. 'use strict'
  6. if ('serviceWorker' in navigator) {
  7. window.addEventListener('load', function () {
  8. navigator.serviceWorker.getRegistrations().then(function (registrations) {
  9. for (var registration of registrations) {
  10. registration.unregister()
  11. .then(function () {
  12. return self.clients.matchAll()
  13. })
  14. .then(function (clients) {
  15. clients.forEach(function (client) {
  16. if (client.url && 'navigate' in client) {
  17. client.navigate(client.url)
  18. }
  19. })
  20. })
  21. }
  22. })
  23. })
  24. }
  25. }())