title: Javascript Service worker onload show notifications
body: <p>I have a service worker that is registered, but I want to loop a function to check for updates on the server and show a notification even when tabs are closed. </p>
  
  <p>With the following code in the serviceworker.js, I get an error; 
  "Uncaught (in promise) TypeError: No active registration available on the ServiceWorkerRegistration."</p>
  
  <pre><code>self.registration.showNotification(title, {
          body: 'We have received a push message',
          icon: '',
          tag: ''
  })
  </code></pre>
  
  <p>I want the notification to pop up when the browser is opens like how Facebook does it. </p>