service-worker

Checking for service worker updates in a single page app

天大地大妈咪最大 提交于 2020-02-23 18:37:29
问题 We have a signal page application that has Service worker installed and active. Now our server rebuilds the app, Service worker file is being updated on the server side. Our client has no idea about this new Service worker file and it is still using old Service worker file. When It works? if I refresh/reload the app, new service worker is being installed . How can we refresh the client if service worker file is being updated on the server and client is not being reloaded? Possible solution :

Checking for service worker updates in a single page app

不羁岁月 提交于 2020-02-23 18:37:22
问题 We have a signal page application that has Service worker installed and active. Now our server rebuilds the app, Service worker file is being updated on the server side. Our client has no idea about this new Service worker file and it is still using old Service worker file. When It works? if I refresh/reload the app, new service worker is being installed . How can we refresh the client if service worker file is being updated on the server and client is not being reloaded? Possible solution :

Checking for service worker updates in a single page app

巧了我就是萌 提交于 2020-02-23 18:37:02
问题 We have a signal page application that has Service worker installed and active. Now our server rebuilds the app, Service worker file is being updated on the server side. Our client has no idea about this new Service worker file and it is still using old Service worker file. When It works? if I refresh/reload the app, new service worker is being installed . How can we refresh the client if service worker file is being updated on the server and client is not being reloaded? Possible solution :

How can we check if response for the request came from Service Worker

对着背影说爱祢 提交于 2020-02-23 04:47:33
问题 In Google Chrome console next to the status code of HTTP Request we have info (from ServiceWorker) . Can Request be aware somehow that the Response came from ServiceWorker? Comparing date from Response Headers maybe? 回答1: By design, a response returned via a FetchEvent#respondWith() is meant to be indistinguishable from a response that had no service worker involvement. This applies regardless of whether the response we're talking about is obtained via XMLHttpRequest , window.fetch() , or

Recommended precache payload size?

佐手、 提交于 2020-01-31 03:59:10
问题 (Publicly asking/answering on behalf of someone.) I'm using Workbox to generate a service worker that precaches resources for my progressive web app. Am I wrong to be reluctant to precache ~20mb of minified JavaScript? It's huge, obviously. 20mb seems way too much. My plan was to just precache the essential stuff, and use runtime caching for the rest. In other words, what are some general heuristics for determining what should and shouldn't be included in the precache payload? 回答1: There's a

Angular: Using TypeScript for Service Worker (ServiceWorkerModule)

99封情书 提交于 2020-01-25 06:55:10
问题 Is it possible to register a ServiceWorker written in TypeScript with @angular/service-worker ? currently registering a service worker looks like this in app.module.ts : ServiceWorkerModule.register('ngsw-worker.js', { enabled: environment.production }) Is it somehow possible to register a ngsw-worker.ts ? At least this is possible with web workers in Angular: const worker = new Worker('../my-worker.worker', { type: 'module' }); my-worker.worker.ts /// <reference lib="webworker" /> import

Can i use service worker caching function in firebase-messaging-sw.js?

核能气质少年 提交于 2020-01-25 06:49:12
问题 So I want to cache my web app assets in a service worker, but I already have firebase messaging SW, can I put my code there or create a new service worker? 回答1: This is what worked for me: - create two service workers: sw.js (for caching and fetch handler) and the firebase-messaging-sw.js as mentioned, sw.js will handle your caching. DO NOT create a "push" or "notificationclick" handler in sw.js create your "push" and "notificationclick" handlers in firebase-messaging-sw.js. I do NOT call any

Aren't PWAs user unfriendly if the service worker is not immediately active?

人走茶凉 提交于 2020-01-25 06:40:15
问题 I posted another question as a brute-force solution to this one (Angular: fully install service worker before anything else) but I thought I'd make a separate one to discuss the use case for when a service worker is used as intended. According to the service worker life cycle (https://developers.google.com/web/fundamentals/primers/service-workers/lifecycle), the SW is installed but it's only active once you then reload the page (you can claim() the page but that's only for calls that happen

Progress bar doesn't work using service workers with angular cli

£可爱£侵袭症+ 提交于 2020-01-24 22:08:22
问题 We are developing Angular(4) app and we enabled service workers using the cli Everything works great except that we have a file upload progress bar that is stuck on 0% and only after it finishes it goes to 100%. We suspect it's because of the service worker since we do not see it on our dev env. What is strange that from my understanding service workers shouldn't work on posts requests. We use regular HttpClient for it. How can this be fixed? Edit : Now I'm sure it is something related to

Progress bar doesn't work using service workers with angular cli

血红的双手。 提交于 2020-01-24 22:08:08
问题 We are developing Angular(4) app and we enabled service workers using the cli Everything works great except that we have a file upload progress bar that is stuck on 0% and only after it finishes it goes to 100%. We suspect it's because of the service worker since we do not see it on our dev env. What is strange that from my understanding service workers shouldn't work on posts requests. We use regular HttpClient for it. How can this be fixed? Edit : Now I'm sure it is something related to