cancel
Showing results for 
Search instead for 
Did you mean: 

Has anyone worked on Service Worker Implementation in SAPUI5 ?

I am trying to improve the performance of the Fiori Apps using SAPUI5 framework by making it a Progressive Web App.

So I was trying to implement a Service Worker which is similar to a web worker and would help in offline browser activity especially mobile apps, and cache all the date on the client side.

The problem I am facing in the request conversion. So what I think is, SAPUI5 uses XHR request which I need to probably convert to FETCH API which Service Worker uses.

If anyone has worked on it, do let me know. I would love to have a discussion.

Regards,

Beni

Former Member
0 Kudos

I am looking for this information too.

Came across this project: https://github.com/pensoffsky/OpenUI5-ServiceWorker

I would love to have the discussion too.

Former Member
0 Kudos

Accepted Solutions (1)

Accepted Solutions (1)

boghyon
Product and Topic Expert
Product and Topic Expert
0 Kudos

Update: Check this blog post by Mehmet to see how to reduce sync XHRs

___

Previous answer..:

No, currently it's not possible to leverage Service Worker because of the heavy usage of sync XHRs in UI5 internally (e.g. requireSync is often used). Service Worker API demands async XHR only as mentioned in MDN:

"A service worker is run in a worker context: it therefore has no DOM access, and runs on a different thread to the main JavaScript that powers your app, so it is not blocking. It is designed to be fully async; as a consequence, APIs such as synchronous XHR and localStorage can't be used inside a service worker."

Therefore, we either have to modify UI5 so that it doesn't send any sync XHR, or we have to wait until UI5 gets rid of sync XHRs completely which will be done hopefully at the end of this year.

Answers (1)

Answers (1)

TimMuchena
Participant
0 Kudos

Hi

Did you make any progress on this topic? I am also interested in using service workers in my SAPUI5 apps

Kind regards