Skip to Content
2

Has anyone worked on Service Worker Implementation in SAPUI5 ?

Mar 20, 2017 at 06:51 AM

414

avatar image

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

10 |10000 characters needed characters left characters exceeded
Former Member

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.

0
Former Member
0
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Best Answer
Boghyon Hoffmann Aug 24, 2017 at 08:39 AM
0

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.

Share
10 |10000 characters needed characters left characters exceeded
Timothy Muchena Apr 12, 2017 at 04:39 PM
0

Hi

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

Kind regards

Share
10 |10000 characters needed characters left characters exceeded