are applications which use the latest web technologies to bring the quality of browser based applications to the next level. requires HTTPS! check browser support: https://jakearchibald.github.io/isserviceworkerready/
network conditions reliable Respond quickly to user interactions with silky smooth animations and no janky scrolling fast Feel like a natural app on the device, with an immersive user experience engaging
Add to Homescreen experience. add manifest Service worker simply cache all application’s assets, so they can be fetched instantly. setup service worker To make your application fully support offline, you need to store application state locally. add offline support Push notifications are simple messages that engage users in an effective way. Enable push notifications
{ console.log('Service worker registered'); }); } else { console.warn('Service worker is not supported in this browser'); } Use sw-precache, offline-plugin or other library to work with Service Worker. Allows to: - Cache static assets - Intercept requests - Use notification API - Use background sync API https://developer.mozilla.org/ en-US/docs/Web/API/ Service_Worker_API
from 'redux-pouchdb'; import PouchDB from 'pouchdb/dist/pouchdb'; const db = new PouchDB('dbname'); // setup reducer const createStoreWithMiddleware = compose( applyMiddlewares, persistentStore(db) )(createStore); /*** reducers/todos.js ***/ import { persistentReducer } from 'redux-pouchdb'; // todos reducer code export default persistentReducer(todos); Use any library for IndexedDB / WebSQL DBs. For Redux try redux-pouchdb. Allows to: - Store application state locally - Sync application state with local DB https://pouchdb.com/
in service worker self.addEventListener('push', (event) => { var defaultData = { title: 'You have completed a todo!', text: 'Nice one ;)' }; var data = (event.data && event.data.json()) || defaultData; var title = data.title; var body = data.text; var tag = 'todo-react-pwa-notification'; var icon = 'icon-192.png'; event.waitUntil( self.registration.showNotification(title, { body, icon, tag }) ); }); 2/2 Allows to: - Respond to notification - Show notification with payload and app’s icon You can also respond to user’s click on notification. https://developer.mozilla.org/ en-US/docs/Web/API/ NotificationEvent
React.js series by Addy Osmani - Your First Progressive Web App by Pete LePage - Progressive Web Apps by Google - Using Web Push Notifcations with VAPID - How to Make Your App a PWA by me