workbox icon indicating copy to clipboard operation
workbox copied to clipboard

[workbox-window] "Installing" event not firing

Open Miodec opened this issue 2 years ago • 1 comments

Library Affected: workbox-window

Browser & Platform: all browsers

Issue or Feature Request Description: When registering a service worker, im trying to detect the start of installation (precaching) using the "installing" event. All other events are working correctly like "installed", "activating", "activated"

Code:

if ("serviceWorker" in navigator) {
  window.addEventListener("load", () => {
    const wb = new Workbox("/service-worker.js");


    wb.addEventListener("installing", (event) => {
      console.log("installing", event);
    });

    wb.addEventListener("installed", (event) => {
      console.log("installed", event);
    });

    wb.addEventListener("activating", (event) => {
      console.log("activating", event);
    });

    wb.addEventListener("activated", (event) => {
      console.log("activated", event);
    });

    console.log(wb);

    wb.register();
    // }
  });
}
...
new WorkboxPlugin.GenerateSW({
      // these options encourage the ServiceWorkers to get in there fast
      // and not allow any straggling "old" SWs to hang around
      clientsClaim: true,
      skipWaiting: true,
      //include the generated css and js files
      maximumFileSizeToCacheInBytes: 11000000,
    }),
...

How can i detect that there is an update available and that it started pre caching the necessary files?

image

Miodec avatar Oct 11 '22 23:10 Miodec

Same problem for me

Doctor-wu avatar Dec 14 '23 15:12 Doctor-wu

Hi there,

Workbox is moving to a new engineering team within Google. As part of this move, we're declaring a partial bug bankruptcy to allow the new team to start fresh. We realize this isn't optimal, but realistically, this is the only way we see it working. For transparency, here're the criteria we applied:

Thanks, and we hope for your understanding! The Workbox team

tomayac avatar Apr 25 '24 08:04 tomayac