title: Check Service worker installation progress from component (angular)
body: <p>I have updated my angular app into PWA, since I need to preload all of the assets on the first launch (application have a lots of images, which are used for UI).
  That's why I would like to show some kind of spinner/loading bar during service worker install event and hide it when it's done. 
  So first question - is it possible to handle this event from the component?</p>
  
  <p>I have found this example and tried to add it inside first component, that loads on app launch,  but didn't get any logs. So probably it doesn't work that way.</p>
  
  <pre><code>ngOnInit() {
  self.addEventListener('install', event =&gt; {
      this.log("INSTALLING ");
      const installCompleted = Promise.resolve()
                          .then(() =&gt; this.log("INSTALLED"));
  
      event.waitUntil(installCompleted);
  });
  
  self.addEventListener('activate', event =&gt; {
      this.log("ACTIVATING");
      const activationCompleted = Promise.resolve()
          .then((activationCompleted) =&gt; this.log("ACTIVATED"));
          event.waitUntil(activationCompleted);
  });
  
  self.addEventListener('fetch', event =&gt; {
      this.log("HTTP call intercepted - " + event.request.url);
          return event.respondWith(fetch(event.request.url));
      });
  }
  
  log(message) {
      console.log(message);
  }
  </code></pre>
  
  <p>Also I have a question about caching assets. In my ngsw-config.json I'm using next setup:</p>
  
  <pre><code>  "name": "assets",
    "installMode": "prefetch",
    "updateMode": "prefetch",
    "resources": {
      "files": [
        "/assets/**"
      ]
    }
  </code></pre>
  
  <p>but when I'm opening first page, in cache it doesn't show all the images and folder from /assets. Not event half of them. Is it ok and it's not supposed to show all the images that are cached? Is it possible that the problem is because I'm using lazy loading modules and service worker start caching when each module is loaded?
  On other hand, when I'm switching pages, in Network tab it shows that each image is loaded from service worker...
  <a href="https://i.stack.imgur.com/1ttrN.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/1ttrN.png" alt="enter image description here"></a></p>
  
  <p>Thanks</p>