title: 'showNotification' of undefined for push notifications
body: <p>I am trying to push my website notifications from browser to android and pc, for that I tried <a href="https://developers.google.com/web/ilt/pwa/introduction-to-push-notifications#understanding_push_notifications_on_the_web" rel="nofollow noreferrer">push notifications</a>.</p>
  
  <p>I followed the documentation and put the following code - </p>
  
  <pre><code>Notification.requestPermission(function(status) {
      console.log('Notification permission status:', status);
  });
  
  function displayNotification() {
    if (Notification.permission == 'granted') {
      navigator.serviceWorker.getRegistration().then(function(reg) {
        console.log("Reg -"+reg);
        reg.showNotification('Hello world!');
      });
    }
    else{
      console.log(Notification.permission);
    }
  }
  </code></pre>
  
  <p>Permission is <code>granted</code> but I am getting error with <code>reg</code> because it is getting <code>undefined</code>.</p>
  
  <p>here is screenshot of my console -</p>
  
  <p><a href="https://i.stack.imgur.com/bXuTV.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/bXuTV.png" alt="enter image description here"></a></p>