UNPKG

apiconnect-explorer

Version:

- [Getting Started](#getting-started) - [Configuration](#configuration) * [Required](#required) * [Optional](#optional) - [Usage in React](#usage-in-react) - [Usage outside of React](#usage-outside-of-react) - [Detailed description of options](#detail

1 lines 1.52 kB
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports["default"]=a,exports.unregister=b;function a(){"production"===process.env.NODE_ENV&&"serviceWorker"in navigator&&window.addEventListener("load",function(){var a="".concat(process.env.PUBLIC_URL,"/service-worker.js");window.drupalSettings&&window.drupalSettings.api&&window.drupalSettings.api.explorer&&window.drupalSettings.api.explorer.options&&window.drupalSettings.api.explorer.options.explorerDir?a="".concat(window.drupalSettings.api.explorer.options.explorerDir,"service-worker.js"):window.Drupal.settings&&window.Drupal.settings.api&&window.Drupal.settings.api.explorer&&window.Drupal.settings.api.explorer.options&&window.Drupal.settings.api.explorer.options.explorerDir?a="".concat(window.Drupal.settings.api.explorer.options.explorerDir,"service-worker.js"):window.apiConnectExplorer&&window.apiConnectExplorer.options&&window.apiConnectExplorer.options.explorerDir&&(a="".concat(window.apiConnectExplorer.options.explorerDir,"service-worker.js")),navigator.serviceWorker.register(a).then(function(a){a.onupdatefound=function(){var b=a.installing;b.onstatechange=function(){"installed"===b.state&&(navigator.serviceWorker.controller?console.log("New content is available; please refresh."):console.log("Content is cached for offline use."))}}})["catch"](function(a){console.error("Error during service worker registration:",a)})})}function b(){"serviceWorker"in navigator&&navigator.serviceWorker.ready.then(function(a){a.unregister()})}