3. Why should I care
Google Workbox3 10/2/2018
Performance
Resilience
Enhance PWA
4. Why Web for Apps?
Google Workbox4 10/2/2018
App: Concerned
About app permissions
Amount of storage
Privacy (what is the app doing?)
Web
Low Friction
Less storage
Twitter Light PWA: 1MB
Twitter Native app (Android): 28 MB
Twitter Native app (IOS): 124 MB
Privacy on device is not an issue
5. Web for Apps means low friction
Google Workbox5 10/2/2018
Loose 20% on each step
Low Friction is the webs secret weapon
https://airhorner.com/
6. Web App vs. Native App
Google Workbox6 10/2/2018
Web App Native App
Push Notification
Full Screen, Icon on Desktop
Offline Working
Phonebook, Alarms
System Settings
Runs on Desktop ()
No App store
Installation experience
1 source code for all devices
Web dev knowledge to build app
7. F I R E
Fast
(rendering)
Integrated
(in UI, payment)
Reliable
(slow connection)
Engaging
(push)
Progressive Web App (PWA)
Google Workbox7 10/2/2018
Progressive Enhancement:
“Combine features offered by most modern browsers
with the benefits of a mobile experience.” (Wikipedia)
8. Service Worker
Google Workbox8 10/2/2018
“Background Thread”, works offline
Network proxy (intercept requests)
Handles “Push Notification” in background
Fast & reliable (if properly configured)
Not disruptive in old browsers (but no benefits)
Available in all major browsers
9. Manifest
Google Workbox9 10/2/2018
Metadata for PWA
Icons
Description
Colors
Related Infos
<link rel="manifest"
href="/manifest.json">
Useful tools:
Generator, based on your site: https://www.pwabuilder.com/
Validator: https://manifest-validator.appspot.com/
15. sw.js: cache images
Google Workbox15 10/2/2018
workbox.routing.registerRoute(
// Cache image files
/.*.(?:png|jpg|jpeg|svg|gif)/,
// Use the cache if it's available
workbox.strategies.cacheFirst({
// Use a custom cache name
cacheName: 'image-cache',
plugins: [
new workbox.expiration.Plugin({
// Cache only 20 images
maxEntries: 20,
// Cache for a maximum of a week
maxAgeSeconds: 7 * 24 * 60 * 60,
})
],
})
);
23. Angular ServiceWorker vs. Workbox
Google Workbox23 10/2/2018
Angular CLI
Pros:
Install is easy: ng add @angular/pwa
Cons:
Angular >= 5 only
Website changes must be handled manually
Workbox
Pros:
Easy to install, Easy to use
Automatically handle web site changes
Know how protection: Works in every web project
Debugging, bug hunting
Professional tool: Ideal for consultancy
24. Demo
Google Workbox24 10/2/2018
1. Implement workbox
Installation CLI
2 steps:
1. Wizard Config-file
2. Config-file Service Worker
Implement Service Worker
2. Activate Proxy
Cache backend: json web service
3. WebPack
Show implementation
25. Save the World
Google Workbox25 10/2/2018
http://offlinefirst.org/
“We live in a disconnected & battery
powered world, but our technology
and best practices are a leftover from
the always connected & steadily
powered past.”
Maureen McElaney, JSConf EU 2017
https://www.youtube.com/watch?v=GOdmPaBJqwA
26. Takeaway 1: Workbox
Google Workbox26 10/2/2018
Service Workers With Workbox
Fast and easy to implement and configure
Less copy paste
Guides through the modern web experience
Encourage to use new features
27. Takeaway 2: Talk
Google Workbox27 10/2/2018
PWA “a set of rules”
For PWA use Google Workbox
To save the world can be fun
28. Session Feedback – now
Google Workbox28 10/2/2018
Please use the Trivadis Events mobile app to give feedback on each session
Use "My schedule" if you have registered for a session
Otherwise use "Agenda" and the search function
If the mobile app does not work (or if you have a Windows smartphone), use your
smartphone browser
– URL: http://trivadis.quickmobileplatform.eu/
– User name: <your_loginname> (such as "svv")
– Password: sent by e-mail...
29. Thank you for saving the world ! Questions ?
Patrik Böschenstein
Senior Consultant
Phone +41 58 459 52 23
patrik.boeschenstein@trivadis.com
10/2/2018 Google Workbox29