Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

209
Visualizações
How is a progressive web app updated - is the install even re-triggered?

In this answer When and how does a PWA update itself? it is explained that a PWA is updated if manifest.json links are updated or if one character is modified from the service-worker.js file.

But what do we exactly mean by "updated"? Does this mean the install event is re-triggered and that all the listed files below are re-downloaded?

Is there a documentation confirming this is the case for all browsers on Android and iOS? (I don't know if the latter uses PWA the same way than on Android)

Here is an example service-worker.js file:

self.addEventListener('install', (e) => {
  e.waitUntil(
    caches.open('myapp-store').then((cache) => cache.addAll([
      '/app/index.html',
      '/app/file1.jpg',   
      '/app/file2.mp3',   
      '/app/file3.png',   
    ])),
  );
});

self.addEventListener('fetch', (e) => {
  console.log(e.request.url);
  e.respondWith(
    caches.match(e.request).then((response) => response || fetch(e.request)),
  );
});
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

The service worker update flow is independent from any update checks that apply to the web app manifest.

"The Service Worker Lifecycle" is recommended reading, and it explains the complain initial install and update flow.

To borrow from that document and answer your question, yes, the install event of the updated service worker file will be executed once a browser detects that update. If your updated service worker file includes a cache.addAll() then that will be executed, and if the URLs being cached are identical to the same URLs previously cached, and the cache name is the same, then the old cached values will be overwritten with whatever is fetche during install.

Many folks include inline versioning information in their service worker file so that they can trigger an update by changing that value. They also might use a new cache name tied to that versioning information, so that instead of overwriting previously cached values, new cache entries will be created. This tends to be safer, since the old service worker will remain in control of open pages until the updated service worker activates, and using versioned cache names means that the old service worker can continue reading the cached values it expects.

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda