I gave my first webinar for Codemotion about Progressive Web Apps (PWAs), the future of web development.
Video (soon in my youtube): https://www.youtube.com/watch?v=de1xiqz-BTE
Twitter: https://twitter.com/JGFerreiro
Linkedin: https://www.linkedin.com/in/jgferreiro/
- - -
I think Progressive Web Apps (PWAs) are the next revolution in web development. This practical workshop will explain the basics about PWAs as well as how to integrate it into your own application.
What we will cover:
• Caching requests and caching strategies.
• Setting up your PWA (manifest and progressive metadata)
• Payments Api, Local Web Notifications
• Other PWA functionalities.
- - -
Subscribe: https://www.ferreiro.me/newsletter
on https://www.twitter.com/jgferreiro
on https://www.linkedin.com/in/jgferreiro/
on https://www.instagram.com/jgferreiro/
20. @JGFERREIRO@JGFERREIRO #CODEMOTIONPWA
๏ Simplified web
version
๏ Data save mode
๏ Limit access to
advanced features
🌍
Progressive enhancement: Example
๏ High quality media
๏ Advanced Features:
Push, background
sync, etc.
United States
Bad 2G connection | Cheap phone 5G connection | High quality phones
%Africa
21. @JGFERREIRO@JGFERREIRO #CODEMOTIONPWA
Progressive enhancement: Simplification
if ('feature' in browser) {
!// Feature is available!!!
!// Do something cool with it!
} else {
!// 😡 Party pooper
!// Browser does not support this feature
!// Change your browser!!...
}
31. @JGFERREIRO@JGFERREIRO #CODEMOTIONPWA
Smaller and 1-click install
Native apps tend to occupy more space.
Offline and notifications!
Improves user retention and converstions.
Adaptative experience
Our apps can adapt to any device.
Distribution Freedom
No need apple store or play store
40. @JGFERREIRO@JGFERREIRO #CODEMOTIONPWA
manifest.json is a file that tells
the browser about your web
application and how it should
behave when 'installed'
https://developers.google.com/web/fundamentals/web-app-manifest
50. SERVICE WORKER :: INSTALL CALLBACK
self.addEventListener('install', (event) !=> {
!// Install anything you need here!
})
self.addEventListener('fetch', (event) !=> {
console.log('I am intercepting network requests!')
const url = event.request.url
console.log('Requested resource url: ', url)
})
Create a new SW.js file
51. SERVICE WORKER :: REGistering new SW
if ('serviceWorker' in navigator) {
console.log('⭐ Start to register a service worker')
navigator.serviceWorker.register('/sw.js')
.then((registration) !=> {
console.log('SW!::Registration', registration)
})
.catch((error) !=> {
console.log('SW!::Error registering', error)
});
}
74. CACHE API :: REMOVING CACHED ASSETS
self.addEventListener('install', (event) !=> {
!// Add assets to the service worker cache
})
self.addEventListener('activate', (event) !=> {
!// Remove cached assets from previous version
!// using caches.delete().
})
Make sure to remove cached ASSETS!
89. @JGFERREIRO
@JGFERREIRO #CODEMOTIONPWA
Whotofollow?
Jake Archibald
Google
@jaffathecake
Alex Russell
Chrome Team
@slightlylate
Sarah Clark
Google
@a_bowl_of_stars
Pete LePage
Google
@petele
Dominick Ng
Chrome PWA
@dominickng
Scott Domes
Indeed
@scottdomes
Kenneth C.
Intel
@kennethrohde
Henrik Joreteg
Consultant
@HenrikJoreteg
Charlie Croom
Twitter
@CharlieCroom
Monica Dinculescu
Polymer
@notwaldorf
90. @JGFERREIRO@JGFERREIRO #CODEMOTIONPWA
Action plan
1. Fork “pwa 101” repo and start it
locally
2. Re-read this presentation, and open
some of the links in the resources
3. Execute each of the steps to add
progressive enhancement to your app
91. @JGFERREIRO
@JGFERREIRO #CODEMOTIONPWA
Resources
1. Google I/O 2014 - Bridging the
gap between the web and apps
2. How we built Twitter Lite
3. Twitter Lite and High
Performance React Progressive
Web Apps at Scale
4. Google workbox
5. Payment request
6. Frontend masters: Progressive web
apps
7. Background sync
8. Google: Progressive web apps
YouTube traiing