!
Say Hello To Offline First
How to build applications for
the real world
we <3 AYB
Slide 2
Slide 2 text
Ola Gasidlo
- Javascript for +10 years, full stack
- Core Member of Hood.ie
- Organizer of OpenTechSchool Dortmund
!
twitter@misprintedtype
github@zoepage
Slide 3
Slide 3 text
Agenda!
1. What & why?
2. Problems
3. New approach
4. Implementation
@misprintedtype
Slide 4
Slide 4 text
What & why?
@misprintedtype
Slide 5
Slide 5 text
The internet turned 25 this year!
@misprintedtype
Slide 6
Slide 6 text
We grew up.
@misprintedtype
Slide 7
Slide 7 text
@misprintedtype
Slide 8
Slide 8 text
amount of mobile-only web users is out of reach
@misprintedtype
Slide 9
Slide 9 text
Tell me...
@misprintedtype
Slide 10
Slide 10 text
@misprintedtype
Slide 11
Slide 11 text
No content
Slide 12
Slide 12 text
“WE CAN’T KEEP BUILDING APPS WITH THE
DESKTOP MINDSET OF PERMANENT, FAST
CONNECTIVITY, WHERE A TEMPORARY
DISCONNECTION OR SLOW SERVICE IS
REGARDED AS A PROBLEM AND
COMMUNICATED AS AN ERROR.”
@misprintedtype
Service Worker
!
- Additional cache
- Deals with all requests
- offline first, push notifications, background sync,
performance
@misprintedtype
Slide 65
Slide 65 text
Service Worker
!
!
!
https://github.com/slightlyoff/ServiceWorker
https://jakearchibald.github.io/isserviceworkerready/
!
https://www.youtube.com/watch?v=SmZ9XcTpMS4&list=PL37ZVnwpeshGPw2RfUGNQbPsU_WGpi05J
@misprintedtype
Slide 66
Slide 66 text
files
data
Slide 67
Slide 67 text
files
data
Slide 68
Slide 68 text
!
Do not harm humans!!
(first law of robotics)
@misprintedtype
Slide 69
Slide 69 text
!
Do not lose data!!
(first law of offline first)
@misprintedtype
Slide 70
Slide 70 text
!
!
!
!
PouchDB + CouchDB = <3
!
@misprintedtype
Slide 71
Slide 71 text
No content
Slide 72
Slide 72 text
No content
Slide 73
Slide 73 text
CouchDB
!
@misprintedtype
Slide 74
Slide 74 text
@misprintedtype
Ruth’s data
(share with John)
John’s data
Ruth’s partial data
(replicated)
Slide 75
Slide 75 text
PouchDB
!
@misprintedtype
Slide 76
Slide 76 text
PouchDB
!
@misprintedtype
Slide 77
Slide 77 text
PouchDB
!
browser storage limitation confirm
Firefox IndexedDB unlimited y
Chrome / Opera /
Android 4.4+
IndexedDB % of storage y
IE 10+ SQLite 250MB n
Mobile Safari WebSQL 50MB n
Sarafi WebSQL 5MB -> 500MB y
Android 4.3 and
lower
IndexedDB 200MB n