Service Worker
Enrich your app
Tobias Sorn, SAP
June 28, 2019

Service Worker

  • Independent from main thread
  • No access to DOM API
  • Installed once runs forever
  • Request interception (proxy)

Prerequisites

ui5-service-worker

Motivation

  • UI5 agnostic
  • Extensible
  • Easy to consume
  • Offline support

Caching Strategies

  • Provide different caching strategies (using Cache Storage)
    • application (uses manifest.json)
    • ui5resource (uses sap-ui-version.json)
    • static (cannot be updated)
    • precache (preloads resources)
    • networkupdate (cache first, update from network)
    • expiration (timed expiration since last request)

UI5 application strategy in detail

application (uses manifest.json)
  1. Configured for app resources
  2. Checks the app version
  3. Updates only on version change
  4. Otherwise from cache

UI5 resources strategy in detail

ui5resource (uses sap-ui-version.json)
  1. Configured for ui5 resources
  2. Checks the ui5 version
  3. Updates only on version change
  4. Otherwise from cache

Demo time

Noteworthy

  • Currently only a TGIF project
    • integration planned
  • Manual steps required

Useful links

Google Developers google dev
MDN Service Worker API
W3C W3C
Thank you.
Contact information:

Tobias Sorn
Senior Developer
tobias.sorn@sap.com