Progressive Web Apps with ReactJSProgressive Web Apps with ReactJSProgressive Web Apps with ReactJSProgressive Web Apps with ReactJSProgressive Web Apps with ReactJSProgressive Web Apps with ReactJSProgressive Web Apps with ReactJSProgressive Web Apps with ReactJSProgressive Web Apps with ReactJSProgressive Web Apps with ReactJSProgressive Web Apps with ReactJSProgressive Web Apps with ReactJSProgressive Web Apps with ReactJSProgressive Web Apps with ReactJSProgressive Web Apps with ReactJSProgressive Web Apps with ReactJSProgressive Web Apps with ReactJSProgressive Web Apps with ReactJSProgressive Web Apps with ReactJS
Trang 1Progressive Web Apps with ReactJS
Full stack Developer, Devops Guy, Book Lover
Trang 2Me
Trang 3Our Agenda
PWA
Trang 4goo.gl/w9Bnge
Trang 8The hardest problem with software is
distribution.
Trang 9Reach
App
Web
Trang 12Progressive Web Apps
● Reliable - Fast loading, work offline (never show the downasaur) and on
flaky network
● Fast - Smooth animations, jank-free scrolling and seamless navigation.
● Engaging - Launched from home screen and send push notification.
Trang 13Technologies Behind Progressive Web Apps
Service Workers
Web App Manifest File
Trang 14Service Workers
Trang 17.then(function(registration) {
console.log('SW registered! Scope is:', registration.scope);}); // catch a registration error
main.js
Trang 18self.addEventListener('install', function(event) {
// Do stuff during install
});
service-worker.js
Trang 19self.addEventListener('activate', function(event) {
// Do stuff during activate
// self.clients.claim ; force control of uncontrolled clients});
service-worker.js
Trang 21Code - Background sync
navigator.serviceWorker.register('/sw.js');
// Later request a one-off sync:
navigator.serviceWorker.ready.then(function(swRegistration) {
});
main.js
Trang 22Service Workers Prerequisites
development purpose we can use localhost
Trang 23<Code />
Trang 24sw-precache
Trang 26sw-toolbox
Trang 27importScripts( 'sw-toolbox/sw-toolbox.js' );
// examples of using strategies
toolbox.router.get( '/getImage*' , toolbox.cacheFirst, {
"Cache" :{
"maxEntries" : 100,
"Name" : "images-cache" ,
"maxAgeSeconds" : 60*60*24 }
});
Trang 28Cache Only
Trang 29Network Only
Trang 30Cache First
Trang 31Network First
Trang 32Fastest
Trang 33Web App Manifest
Trang 35"icons": [
{
"src": "images/Airhorner_192.png" , "type": "image/png" ,
"name" : "The Air Horner" ,
"short_name": "Air Horner" ,
}
Trang 36<Code />
Trang 37Demo
Trang 38Lighthouse
Trang 40Tips and Notes
connection
cross-browser
Trang 41let's build something awesome
Trang 42Thank you