Going offline with Service Worker
summary
Live demos register a service worker with navigator.serviceWorker.register, intercept fetch events and use the Cache API to implement cached articles, network-then-cache pages, stale-while-revalidate stats, and a generic-avatar fallback; code clones responses because responses are streams. Push uses Chrome/GCM endpoints via the registration.pushManager and prefetches payload before showing notifications. Background sync registers named sync events so failed form submits retry when online. Sixty-six percent support is cited and devtools show service worker, cache storage and fake push controls.
AI-written summary · about
chapters (26)
- 0:00Intro
- 1:00Web is powerful
- 1:45Web platform gaps
- 2:28About Konrad
- 3:19Service Worker
- 4:03Reduce Service Worker
- 5:41URL Object
- 6:23Fetch API
- 6:58Response Object
- 7:50Cash API
- 9:37Example
- 10:30Fetch events
- 12:36Service Worker implementation
- 13:29Network
- 13:55Categories
- 14:48Avatars
- 16:24Mock requests
- 16:50Push
- 17:11Manifest
- 17:46Registration
- 20:18Background synchronization
- 21:15Single event sync
- 22:00Register Service Worker
- 22:52Service Worker Event
- 23:23Dev Tools
- 25:13Questions
