progress callback is never called when service worker is activated #990

Open
opened 2018-03-15 09:28:00 +00:00 by antoinezaz · 3 comments
antoinezaz commented 2018-03-15 09:28:00 +00:00 (Migrated from github.com)

It seems XMLHttpRequest isn't supported when service worker is activated : https://www.fxsitecompat.com/en-CA/docs/2015/xmlhttprequest-is-no-longer-available-in-service-workers/
It probably cause the no trigger progress callback.
The fetch API can be the solution to fix this issue.

It seems XMLHttpRequest isn't supported when service worker is activated : https://www.fxsitecompat.com/en-CA/docs/2015/xmlhttprequest-is-no-longer-available-in-service-workers/ It probably cause the no trigger progress callback. The [fetch API](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API) can be the solution to fix this issue.
Jun711 commented 2018-12-22 02:00:32 +00:00 (Migrated from github.com)

ng2-file-upload can't be used in a pwa if xhr is not changed to fetch then?

ng2-file-upload can't be used in a pwa if xhr is not changed to fetch then?
omardoma commented 2019-02-19 20:34:36 +00:00 (Migrated from github.com)

Did anyone ever figure out a workaround for this issue ?

Did anyone ever figure out a workaround for this issue ?
Jun711 commented 2019-04-02 04:52:10 +00:00 (Migrated from github.com)

@omardoma
in case you haven't figured out the workaround, in your service worker file which is ngsw-worker.js (if it is from Angular cli), in the onFetch function, you should modify the function so that it stops executing when detecting your upload endpoint.

You can check out this article for more information

@omardoma in case you haven't figured out the workaround, in your service worker file which is ngsw-worker.js (if it is from Angular cli), in the onFetch function, you should modify the function so that it stops executing when detecting your upload endpoint. You can check out this [article](https://jun711.github.io/web/how-to-listen-for-upload-progress-in-service-worker-and-progressive-web-app/) for more information
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: dc/ng2-file-upload#990