summaryrefslogtreecommitdiffstats
path: root/mobile/android/geckoview/src/androidTest/assets/www/worker/open_window.js
blob: 921cff5b091f49284bf501c5ffab16e28da8de19 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
navigator.serviceWorker.register("./service-worker.js", {
  scope: ".",
});

function showNotification() {
  Notification.requestPermission(function (result) {
    if (result === "granted") {
      navigator.serviceWorker.ready.then(function (registration) {
        registration.showNotification("Open Window Notification", {
          body: "Hello",
        });
      });
    }
  });
}