Description
In this previous post, I talked about implementation of IndexedDB inside Service Workers. If you don’t understand that part, please read that article to clear up some concepts about service workers…
Summary
- JavaScript How to use IndexedDB to build Progressive Web Apps In this previous post, I talked about implementation of IndexedDB inside Service Workers.
- To insert or do any operations on database, we need to get the transaction object from the database.
- Use keyPath as URL endpoint that you would like to use for offline access.
- Inside service worker’s fetch event handler, if a request starts with /offline-api, then fetch data from database with key equal to the path of the request.