I am registering new service worker for receiving push notifications:

const registration = await navigator.serviceWorker.register("/js/serviceWorker-bundle.js", {
  scope: "/"
});

console.log(registration.active);

But console.log printing null what means worker is not still registered. It worked few hours and now it does not work. Why await is not waiting until worker is registered and active so I can do subscribe?

0 Answers