Browser Database for offline application use
19/12/2022
WHO AM I?
AGENDA
Introduction
Offline-first
What? Why? How?
Example
IndexedDB demo
Challenges
Online/offline status & Sync with remote DB …
Q&A
Question & Answers
Introduction
Hi Youssef! We have to make our application work as well without internet connection.
Without internet connection??
Offline-first
“Offline-first is a development paradigm whereby developers ensure that the app will work as well offline as it does online, and it is not affected by a complete lack of or poor quality of network connection”
VS
UX
Performance
Usable all the time
Static
Dynamic
Page assets
CSS/JS/Images/Fonts/Documents …
Service worker
Browser cache
App cache
Dynamic data
API calls/XHR …
Web storage
Web SQL*
IndexedDB
Web Storage
5Mb
IndexedDB
IndexedDB is a low-level API for client-side storage of significant amounts of structured data, including files/blobs
IndexedDB
Transactional
Example
Challenges
IndexedDB: Complex API
What about sync?
Is it our responsibility?
How to detect offline / online status?
API call - XHR
*Opera mini: ✗ Not supported
Navigator event: navigator.onLine*
Question & Answers
Feel free to get in touch with me. Let's talk about everything!