Sha256: fdb417052ae61007f05f00ffbd9551522a856052888b1154eac1d98ba38924aa

Contents?: true

Size: 721 Bytes

Versions: 12

Compression:

Stored size: 721 Bytes

Contents

// check if the browser supports serviceWorker at all
window.addEventListener("load", async () => {
  if ("serviceWorker" in navigator) {
    await navigator.serviceWorker.register("/sw.js", { scope: "/" });

    const mandatoryElements = document.querySelector(".js-sw-mandatory");
    // Opera uses Opera for versions <= 12 and OPR for versions > 12
    const isOperaMini =
      ((navigator.userAgent.indexOf("OPR") > -1) || (navigator.userAgent.indexOf("Opera") > -1)) &&
      (navigator.userAgent.indexOf("Mini") > -1);

    if (mandatoryElements && isOperaMini) {
      mandatoryElements.classList.add("hide")
    }
  } else {
    console.log("Your browser doesn't support service workers 🤷‍♀️");
  }
});

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
decidim-core-0.27.9 app/packs/src/decidim/sw/loader.js
decidim-core-0.27.8 app/packs/src/decidim/sw/loader.js
decidim-core-0.27.7 app/packs/src/decidim/sw/loader.js
decidim-core-0.27.6 app/packs/src/decidim/sw/loader.js
decidim-core-0.27.5 app/packs/src/decidim/sw/loader.js
decidim-core-0.27.4 app/packs/src/decidim/sw/loader.js
decidim-core-0.27.3 app/packs/src/decidim/sw/loader.js
decidim-core-0.27.2 app/packs/src/decidim/sw/loader.js
decidim-core-0.27.1 app/packs/src/decidim/sw/loader.js
decidim-core-0.27.0 app/packs/src/decidim/sw/loader.js
decidim-core-0.27.0.rc2 app/packs/src/decidim/sw/loader.js
decidim-core-0.27.0.rc1 app/packs/src/decidim/sw/loader.js