SlideShare ist ein Scribd-Unternehmen logo
1 von 38
Downloaden Sie, um offline zu lesen
P.W.A.
with
LitHTML
/razvan-rosu
/razvan-rosu
@rzvn_rosuRăzvan Roșu
What are P.W.A.?
Progressive Web Apps are websites
built using web technologies
but act and feel like an app.
Why P.W.A.?
“Progressive Web Apps are a new way
to deliver amazing user experience on the web”
- Google
User onboarding study case:
“Every step in an onboarding flow
costs 20% of users (on average)”
https://medium.com/gabor/every-step-costs-you-20-of-users-b613a804c329
Quick comparison: App vs PWA
(Native) User flow:
- find the app
- install the app
- open
- use
- share
(PWA) User flow:
- immediately use the web app
- prompt to install upon return
Quick comparison: App vs PWA
Native:
- native apps with push
notifications retain 30%
more users than
native apps without
- a user is more likely to
reopen a mobile application
than a website
PWA:
- have push notifications
- can be installed
PWA
characteristics
1. Loads quickly (app shell)
2. Cross device (responsive UI)
3. Offline (service workers)
4. Installable (app manifest)
5. Engaging (push notification)
1. Loads quickly (app shell)
The key feature is to progressively load the app.
Initially, we load an empty app shell with a loader.
Afterwards, we lazy load the content.
PWA
characteristics
1. Loads quickly (app shell)
2. Cross device (responsive UI)
3. Offline (service workers)
4. Installable (app manifest)
5. Engaging (push notification)
2. Cross device (responsive UI)
Progressive Web Apps run on any device
within a browser engine.
The user interface can scale accordingly using
Responsive Web Design techniques.
PWA
characteristics
1. Loads quickly (app shell)
2. Cross device (responsive UI)
3. Offline (service workers)
4. Installable (app manifest)
5. Engaging (push notification)
3. Offline (service workers)
Progressive Web Apps can run offline
with the help of Service Workers (SW).
3. Offline (service workers)
Service Worker (SW):
- it is a script
- it runs in the background, separate from the webpage
- it can synchronize offline content
- it has a lifecycle
Service Workers require a server with HTTPS
3. Offline (service workers)
Service Workers generators:
- sw-precache
https://github.com/GoogleChromeLabs/sw-precache
- workbox
https://developers.google.com/web/tools/workbox/
Or, we can build a sw from scratch:
https://developer.mozilla.org/en-US/docs/Web/API/Service
_Worker_API
PWA
characteristics
1. Loads quickly (app shell)
2. Cross device (responsive UI)
3. Offline (service workers)
4. Installable (app manifest)
5. Engaging (push notification)
4. Installable (app manifest)
Progressive Web Apps can be installed with
the help of a manifest.
https://developers.google.com/web/fundamentals/web-app-manifest/
4. Installable (app manifest)
<link rel="manifest" href="./manifest.json">
{
"name": "Proof of Concept: Polymer 3 Progressive Web App",
"short_name": "PoC: PWA",
"description": "a demo of a progressive web app",
"icons": [
{
"src": "assets/android-launchericon-144-144.png",
"sizes": "144x144",
"type": "image/png"
},
…
],
"start_url": "/",
"display": "standalone",
"orientation": "portrait",
"background_color": "#FE7A22",
"theme_color": "#FE7A22"
}
name: defines how the application will be listed
short_name: in Chrome for Android, it is the name to accompany the icon
on the home screen
description: general description of the app
icons: array of images serving as a set of icons and splash screens
start_url: starting URL of the application
display: defines the default display mode (fullscreen, standalone,
minimal-ui, browser)
orientation: portrait or landscape
theme_color: on Android, status bar color
background_color: background color of the app; in Chrome, also
background color of the splashscreen
4. Installable (app manifest)
There is an alternative to the manual declarations: PWACompat.
PWACompat is a library that will generate the meta tags.
<link rel="manifest" href="manifest.webmanifest">
<!-- include PWACompat _after_ your manifest →
<script async src="https://cdn.jsdelivr.net/npm/pwacompat@2.0.6/pwacompat.min.js"
integrity="sha384-GOaSLecPIMCJksN83HLuYf9FToOiQ2Df0+0ntv7ey8zjUHESXhthwvq9hXAZTifA"
crossorigin="anonymous"></script>
! Both manifest.json and manifest.webmanifest seem to work just
fine with PWAcompat.
https://github.com/GoogleChromeLabs/pwacompat
https://www.npmjs.com/package/pwacompat
PWA
characteristics
1. Loads quickly (app shell)
2. Cross device (responsive UI)
3. Offline (service workers)
4. Installable (app manifest)
5. Engaging (push notification)
5. Engaging (push notifications)
Push notifications were initially available only in native apps.
A user would still receive web push notifications
even if the PWA is not open in a browser tab,
and even if the browser is closed.
5. Engaging (push notifications)
The PWA will ask the user for permissions
to display notifications.
The PWA also needs to be subscribed to a Push server,
in order to receive the notifications.
Each browser vendor has his own Push server.
Subscription token example:
{
"endpoint":"https://fcm.googleapis.com/fcm/send/c7Veb8VpyM0:APA91bGnMFx8GIxf__UVy6vJ-n9i728CUJSR1UHBPAKO
CE_SrwgyP2N8jL4MBXf8NxIqW6NCCBg01u8c5fcY0kIZvxpDjSBA75sVz64OocQ-DisAWoW7PpTge3SwvQAx5zl_45aAXuvS",
"expirationTime": null,
"keys": {
"p256dh": "BJsj63kz8RPZe8Lv1uu-6VSzT12RjxtWyWCzfa18RZ0-8sc5j80pmSF1YXAj0HnnrkyIimRgLo8ohhkzNA7lX4w",
"auth": "TJXqKozSJxcWvtQasEUZpQ"
}
}
PWA
characteristics
1. Loads quickly (app shell)
2. Cross device (responsive UI)
3. Offline (service workers)
4. Installable (app manifest)
5. Engaging (push notification)
Quick demo inspection:
jsonplaceholder.typicode.com
/users
/posts?userId=${id}
DEMO
PWA Installation MacOS: https://vimeo.com/320142145
PWA notifications MacOS: https://vimeo.com/320142268
PWA offline (SW) MacOS: https://vimeo.com/320141344
PWA iOS: https://vimeo.com/320148762
https://razvan-rosu.github.io/demo-polymer3-pwa/
Important mentions:
In March 2018, Google announced .app TLD for PWAs https://get.app/
In March 2018, iOS started supporting PWAs. (Probably since then) the App Store
allows PWAs
https://medium.com/@firt/progressive-web-apps-on-ios-are-here-d00430dee3a7
In June 2018, Microsoft started allowing PWAs in the Microsoft Store
https://docs.microsoft.com/en-us/microsoft-edge/progressive-web-apps/microsoft-stor
e
In January 2019, Google started allowing PWAs in the Google Play Store
https://medium.com/@firt/google-play-store-now-open-for-progressive-web-apps-ec6f3c6ff3cc
LitHTML
App structure:
index.html app-core.js custom-header.js
speakers-list.js
talks-list.js
custom-footer.js
logo-component.js
speaker-card.js
talk-card.js
installer-component.js
Basic component w/ LitElement
import {LitElement, html} from '@polymer/lit-element';
class LogoComponent extends LitElement {
constructor() {
super();
}
static get properties() {
return {...};
}
render() {
return html`
<style>...</style>
<a class="LogoComponent" href=${this.logourl}>
<img class="LogoComponent-image" src=${this.imageurl} alt=${this.imagealt} title=${this.imagetitle}>
</a>
`
}
}
customElements.define('logo-component', LogoComponent);
Child components and Lit directives
import {LitElement, html} from '@polymer/lit-element';
import {repeat} from 'lit-html/directives/repeat.js';
import './photo-card.js';
...
render() {
return html`
<style></style>
<ul class="PhotographerCardList">
${repeat(this.photographers, i => html`
<li class="PhotographerCardList-item">
<photographer-card id="${i.id}" name="${i.name}" phone="${i.phone}"></photographer-card>
</li>
`)}
</ul>
`
}
Binding to attributes
constructor() {
super();
this._clickMethod = this._clickMethod.bind(this);
}
_clickMethod(number) {
// GET albums
fetch(`https://jsonplaceholder.typicode.com/posts?userId=${number}`)
.then((r) => {
if (!r.ok) { throw Error(r.statusText); }
return r;
})
.then((r) => r.json())
.then((r) => {window.__TALKS__ = r})
.then(() => {
const event = new CustomEvent('injectTalks', { bubbles: true, composed: true });
window.dispatchEvent(event);
})
.catch(function (error) {
console.log('failed to load talks, error);
});
}
<button class="Speaker_c2a" type="button" @click="${this._clickMethod.bind(null, this.id)}">View talks (id: #${this.id})</button>
Passing data
<speakers-list
title="Speakers:"
.speakers="${this.speakers}"
></speakers-list>
Thank you!
Questions
?
References
● PWA examples:
https://pwa.rocks
● PWA:
https://developers.google.com/web/progressive-web-apps/
● Workbox:
https://developers.google.com/web/tools/workbox/
● PWAcompat:
https://developers.google.com/web/updates/2018/07/pwacompat
● LitHTML:
https://lit-html.polymer-project.org/
● Demo:
https://razvan-rosu.github.io/demo-polymer3-pwa/

Weitere ähnliche Inhalte

Was ist angesagt?

Bruce Lawson: Progressive Web Apps: the future of Apps
Bruce Lawson: Progressive Web Apps: the future of AppsBruce Lawson: Progressive Web Apps: the future of Apps
Bruce Lawson: Progressive Web Apps: the future of Appsbrucelawson
 
Basic Understanding of Progressive Web Apps
Basic Understanding of Progressive Web AppsBasic Understanding of Progressive Web Apps
Basic Understanding of Progressive Web AppsAnjaliTanpure1
 
Progressive Web Apps: Opera's perspective
Progressive Web Apps: Opera's perspectiveProgressive Web Apps: Opera's perspective
Progressive Web Apps: Opera's perspectiveAndreas Bovens
 
Introduction to Progressive Web Apps, Google Developer Summit, Seoul - South ...
Introduction to Progressive Web Apps, Google Developer Summit, Seoul - South ...Introduction to Progressive Web Apps, Google Developer Summit, Seoul - South ...
Introduction to Progressive Web Apps, Google Developer Summit, Seoul - South ...Robert Nyman
 
[wvbcn] Adaptive Images in Responsive Web Design
[wvbcn] Adaptive Images in Responsive Web Design[wvbcn] Adaptive Images in Responsive Web Design
[wvbcn] Adaptive Images in Responsive Web DesignChristopher Schmitt
 
Amp Overview #YGLF 2016
Amp Overview #YGLF 2016Amp Overview #YGLF 2016
Amp Overview #YGLF 2016Ido Green
 
PWA Roadshow Seoul - HTTPS
PWA Roadshow Seoul - HTTPSPWA Roadshow Seoul - HTTPS
PWA Roadshow Seoul - HTTPSChang W. Doh
 
Building for Your Next Billion - Google I/O 2017
Building for Your Next Billion - Google I/O 2017Building for Your Next Billion - Google I/O 2017
Building for Your Next Billion - Google I/O 2017Robert Nyman
 
The Expanding Nature of SEO (MarTech 2016)
The Expanding Nature of SEO (MarTech 2016)The Expanding Nature of SEO (MarTech 2016)
The Expanding Nature of SEO (MarTech 2016)Micah Fisher-Kirshner
 
[peachpit] Adaptive Images in Responsive Web Design
[peachpit] Adaptive Images in Responsive Web Design[peachpit] Adaptive Images in Responsive Web Design
[peachpit] Adaptive Images in Responsive Web DesignChristopher Schmitt
 
Progressive Web Apps for Education
Progressive Web Apps for EducationProgressive Web Apps for Education
Progressive Web Apps for EducationChris Love
 
2017 Silicon Valley Code Camp: Instant Mobile Web
2017 Silicon Valley Code Camp: Instant Mobile Web2017 Silicon Valley Code Camp: Instant Mobile Web
2017 Silicon Valley Code Camp: Instant Mobile WebLisa Huang
 
[psuweb] Adaptive Images in Responsive Web Design
[psuweb] Adaptive Images in Responsive Web Design[psuweb] Adaptive Images in Responsive Web Design
[psuweb] Adaptive Images in Responsive Web DesignChristopher Schmitt
 
[drupalcampatx] Adaptive Images in Responsive Web Design
[drupalcampatx] Adaptive Images in Responsive Web Design[drupalcampatx] Adaptive Images in Responsive Web Design
[drupalcampatx] Adaptive Images in Responsive Web DesignChristopher Schmitt
 
Introduction aux progressive web apps
Introduction aux progressive web appsIntroduction aux progressive web apps
Introduction aux progressive web apps✅ William Pinaud
 
JSUG - Maven by Michael Greifeneder
JSUG - Maven by Michael GreifenederJSUG - Maven by Michael Greifeneder
JSUG - Maven by Michael GreifenederChristoph Pickl
 

Was ist angesagt? (17)

Bruce Lawson: Progressive Web Apps: the future of Apps
Bruce Lawson: Progressive Web Apps: the future of AppsBruce Lawson: Progressive Web Apps: the future of Apps
Bruce Lawson: Progressive Web Apps: the future of Apps
 
Basic Understanding of Progressive Web Apps
Basic Understanding of Progressive Web AppsBasic Understanding of Progressive Web Apps
Basic Understanding of Progressive Web Apps
 
Progressive Web Apps: Opera's perspective
Progressive Web Apps: Opera's perspectiveProgressive Web Apps: Opera's perspective
Progressive Web Apps: Opera's perspective
 
Introduction to Progressive Web Apps, Google Developer Summit, Seoul - South ...
Introduction to Progressive Web Apps, Google Developer Summit, Seoul - South ...Introduction to Progressive Web Apps, Google Developer Summit, Seoul - South ...
Introduction to Progressive Web Apps, Google Developer Summit, Seoul - South ...
 
[wvbcn] Adaptive Images in Responsive Web Design
[wvbcn] Adaptive Images in Responsive Web Design[wvbcn] Adaptive Images in Responsive Web Design
[wvbcn] Adaptive Images in Responsive Web Design
 
Amp Overview #YGLF 2016
Amp Overview #YGLF 2016Amp Overview #YGLF 2016
Amp Overview #YGLF 2016
 
PWA Roadshow Seoul - HTTPS
PWA Roadshow Seoul - HTTPSPWA Roadshow Seoul - HTTPS
PWA Roadshow Seoul - HTTPS
 
Building for Your Next Billion - Google I/O 2017
Building for Your Next Billion - Google I/O 2017Building for Your Next Billion - Google I/O 2017
Building for Your Next Billion - Google I/O 2017
 
The Expanding Nature of SEO (MarTech 2016)
The Expanding Nature of SEO (MarTech 2016)The Expanding Nature of SEO (MarTech 2016)
The Expanding Nature of SEO (MarTech 2016)
 
Upload[1]
Upload[1]Upload[1]
Upload[1]
 
[peachpit] Adaptive Images in Responsive Web Design
[peachpit] Adaptive Images in Responsive Web Design[peachpit] Adaptive Images in Responsive Web Design
[peachpit] Adaptive Images in Responsive Web Design
 
Progressive Web Apps for Education
Progressive Web Apps for EducationProgressive Web Apps for Education
Progressive Web Apps for Education
 
2017 Silicon Valley Code Camp: Instant Mobile Web
2017 Silicon Valley Code Camp: Instant Mobile Web2017 Silicon Valley Code Camp: Instant Mobile Web
2017 Silicon Valley Code Camp: Instant Mobile Web
 
[psuweb] Adaptive Images in Responsive Web Design
[psuweb] Adaptive Images in Responsive Web Design[psuweb] Adaptive Images in Responsive Web Design
[psuweb] Adaptive Images in Responsive Web Design
 
[drupalcampatx] Adaptive Images in Responsive Web Design
[drupalcampatx] Adaptive Images in Responsive Web Design[drupalcampatx] Adaptive Images in Responsive Web Design
[drupalcampatx] Adaptive Images in Responsive Web Design
 
Introduction aux progressive web apps
Introduction aux progressive web appsIntroduction aux progressive web apps
Introduction aux progressive web apps
 
JSUG - Maven by Michael Greifeneder
JSUG - Maven by Michael GreifenederJSUG - Maven by Michael Greifeneder
JSUG - Maven by Michael Greifeneder
 

Ähnlich wie Progressive Web Apps with LitHTML (BucharestJS Meetup)

PWA basics for developers
PWA basics for developersPWA basics for developers
PWA basics for developersFilip Rakowski
 
Planning Your Progressive Web App
Planning Your Progressive Web AppPlanning Your Progressive Web App
Planning Your Progressive Web AppJason Grigsby
 
Progressive web app testing
Progressive web app testingProgressive web app testing
Progressive web app testingKalhan Liyanage
 
Introduction of Progressive Web App
Introduction of Progressive Web AppIntroduction of Progressive Web App
Introduction of Progressive Web AppSankalp Khandelwal
 
Introduction to Offline Progressive Web Applications
Introduction to Offline Progressive Web ApplicationsIntroduction to Offline Progressive Web Applications
Introduction to Offline Progressive Web ApplicationsIlia Idakiev
 
Progressive web apps with Angular 2
Progressive web apps with Angular 2Progressive web apps with Angular 2
Progressive web apps with Angular 2Manfred Steyer
 
Real-Time Web applications with WebSockets
Real-Time Web applications with WebSocketsReal-Time Web applications with WebSockets
Real-Time Web applications with WebSocketsStanislav Zozulia
 
Push notification to the open web
Push notification to the open webPush notification to the open web
Push notification to the open webAhmed Gamal
 
Progressive Web Apps - Up & Running
Progressive Web Apps - Up & RunningProgressive Web Apps - Up & Running
Progressive Web Apps - Up & RunningSuraj Kumar
 
Why progressive apps for WordPress - WordSesh 2020
Why progressive apps for WordPress - WordSesh 2020Why progressive apps for WordPress - WordSesh 2020
Why progressive apps for WordPress - WordSesh 2020Imran Sayed
 
Mastering Microservices with Kong (DevoxxUK 2019)
Mastering Microservices with Kong (DevoxxUK 2019)Mastering Microservices with Kong (DevoxxUK 2019)
Mastering Microservices with Kong (DevoxxUK 2019)Maarten Mulders
 
How to Develop Progressive Web Apps in Flutter – Step by Step Guide.pptx
How to Develop Progressive Web Apps in Flutter – Step by Step Guide.pptxHow to Develop Progressive Web Apps in Flutter – Step by Step Guide.pptx
How to Develop Progressive Web Apps in Flutter – Step by Step Guide.pptxBOSC Tech Labs
 
Progressive Web Apps
Progressive Web AppsProgressive Web Apps
Progressive Web AppsUnfold UI
 
JDD 2017: 7 things which you should care about before release your code to pr...
JDD 2017: 7 things which you should care about before release your code to pr...JDD 2017: 7 things which you should care about before release your code to pr...
JDD 2017: 7 things which you should care about before release your code to pr...PROIDEA
 

Ähnlich wie Progressive Web Apps with LitHTML (BucharestJS Meetup) (20)

Progressive Web Apps
Progressive Web AppsProgressive Web Apps
Progressive Web Apps
 
Checklist for progressive web app development
Checklist for progressive web app developmentChecklist for progressive web app development
Checklist for progressive web app development
 
PWA basics for developers
PWA basics for developersPWA basics for developers
PWA basics for developers
 
GWT and PWA
GWT and PWAGWT and PWA
GWT and PWA
 
Progressive Web Apps
Progressive Web AppsProgressive Web Apps
Progressive Web Apps
 
Planning Your Progressive Web App
Planning Your Progressive Web AppPlanning Your Progressive Web App
Planning Your Progressive Web App
 
Progressive web app testing
Progressive web app testingProgressive web app testing
Progressive web app testing
 
Introduction of Progressive Web App
Introduction of Progressive Web AppIntroduction of Progressive Web App
Introduction of Progressive Web App
 
Progressive web app
Progressive web appProgressive web app
Progressive web app
 
Introduction to Offline Progressive Web Applications
Introduction to Offline Progressive Web ApplicationsIntroduction to Offline Progressive Web Applications
Introduction to Offline Progressive Web Applications
 
Progressive web apps with Angular 2
Progressive web apps with Angular 2Progressive web apps with Angular 2
Progressive web apps with Angular 2
 
Real-Time Web applications with WebSockets
Real-Time Web applications with WebSocketsReal-Time Web applications with WebSockets
Real-Time Web applications with WebSockets
 
Progressive Web Apps
Progressive Web AppsProgressive Web Apps
Progressive Web Apps
 
Push notification to the open web
Push notification to the open webPush notification to the open web
Push notification to the open web
 
Progressive Web Apps - Up & Running
Progressive Web Apps - Up & RunningProgressive Web Apps - Up & Running
Progressive Web Apps - Up & Running
 
Why progressive apps for WordPress - WordSesh 2020
Why progressive apps for WordPress - WordSesh 2020Why progressive apps for WordPress - WordSesh 2020
Why progressive apps for WordPress - WordSesh 2020
 
Mastering Microservices with Kong (DevoxxUK 2019)
Mastering Microservices with Kong (DevoxxUK 2019)Mastering Microservices with Kong (DevoxxUK 2019)
Mastering Microservices with Kong (DevoxxUK 2019)
 
How to Develop Progressive Web Apps in Flutter – Step by Step Guide.pptx
How to Develop Progressive Web Apps in Flutter – Step by Step Guide.pptxHow to Develop Progressive Web Apps in Flutter – Step by Step Guide.pptx
How to Develop Progressive Web Apps in Flutter – Step by Step Guide.pptx
 
Progressive Web Apps
Progressive Web AppsProgressive Web Apps
Progressive Web Apps
 
JDD 2017: 7 things which you should care about before release your code to pr...
JDD 2017: 7 things which you should care about before release your code to pr...JDD 2017: 7 things which you should care about before release your code to pr...
JDD 2017: 7 things which you should care about before release your code to pr...
 

Mehr von Razvan Rosu

Design systems - Razvan Rosu
Design systems - Razvan RosuDesign systems - Razvan Rosu
Design systems - Razvan RosuRazvan Rosu
 
Web Accessibility - Razvan Rosu
Web Accessibility - Razvan RosuWeb Accessibility - Razvan Rosu
Web Accessibility - Razvan RosuRazvan Rosu
 
Front-end build tools - Webpack
Front-end build tools - WebpackFront-end build tools - Webpack
Front-end build tools - WebpackRazvan Rosu
 
Thinking in components
Thinking in componentsThinking in components
Thinking in componentsRazvan Rosu
 
Web optimizations Back to the basics - Razvan Rosu
Web optimizations  Back to the basics - Razvan RosuWeb optimizations  Back to the basics - Razvan Rosu
Web optimizations Back to the basics - Razvan RosuRazvan Rosu
 
CSS Grid Layout - Razvan Rosu
CSS Grid Layout - Razvan RosuCSS Grid Layout - Razvan Rosu
CSS Grid Layout - Razvan RosuRazvan Rosu
 
Atomic design - Razvan Rosu
Atomic design - Razvan RosuAtomic design - Razvan Rosu
Atomic design - Razvan RosuRazvan Rosu
 

Mehr von Razvan Rosu (7)

Design systems - Razvan Rosu
Design systems - Razvan RosuDesign systems - Razvan Rosu
Design systems - Razvan Rosu
 
Web Accessibility - Razvan Rosu
Web Accessibility - Razvan RosuWeb Accessibility - Razvan Rosu
Web Accessibility - Razvan Rosu
 
Front-end build tools - Webpack
Front-end build tools - WebpackFront-end build tools - Webpack
Front-end build tools - Webpack
 
Thinking in components
Thinking in componentsThinking in components
Thinking in components
 
Web optimizations Back to the basics - Razvan Rosu
Web optimizations  Back to the basics - Razvan RosuWeb optimizations  Back to the basics - Razvan Rosu
Web optimizations Back to the basics - Razvan Rosu
 
CSS Grid Layout - Razvan Rosu
CSS Grid Layout - Razvan RosuCSS Grid Layout - Razvan Rosu
CSS Grid Layout - Razvan Rosu
 
Atomic design - Razvan Rosu
Atomic design - Razvan RosuAtomic design - Razvan Rosu
Atomic design - Razvan Rosu
 

Kürzlich hochgeladen

Powering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data StreamsPowering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data StreamsSafe Software
 
Machine Learning Software Engineering Patterns and Their Engineering
Machine Learning Software Engineering Patterns and Their EngineeringMachine Learning Software Engineering Patterns and Their Engineering
Machine Learning Software Engineering Patterns and Their EngineeringHironori Washizaki
 
VictoriaMetrics Anomaly Detection Updates: Q1 2024
VictoriaMetrics Anomaly Detection Updates: Q1 2024VictoriaMetrics Anomaly Detection Updates: Q1 2024
VictoriaMetrics Anomaly Detection Updates: Q1 2024VictoriaMetrics
 
OpenChain Education Work Group Monthly Meeting - 2024-04-10 - Full Recording
OpenChain Education Work Group Monthly Meeting - 2024-04-10 - Full RecordingOpenChain Education Work Group Monthly Meeting - 2024-04-10 - Full Recording
OpenChain Education Work Group Monthly Meeting - 2024-04-10 - Full RecordingShane Coughlan
 
Patterns for automating API delivery. API conference
Patterns for automating API delivery. API conferencePatterns for automating API delivery. API conference
Patterns for automating API delivery. API conferencessuser9e7c64
 
SAM Training Session - How to use EXCEL ?
SAM Training Session - How to use EXCEL ?SAM Training Session - How to use EXCEL ?
SAM Training Session - How to use EXCEL ?Alexandre Beguel
 
The Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptx
The Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptxThe Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptx
The Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptxRTS corp
 
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...Angel Borroy López
 
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...OnePlan Solutions
 
Comparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdfComparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdfDrew Moseley
 
Best Angular 17 Classroom & Online training - Naresh IT
Best Angular 17 Classroom & Online training - Naresh ITBest Angular 17 Classroom & Online training - Naresh IT
Best Angular 17 Classroom & Online training - Naresh ITmanoharjgpsolutions
 
Real-time Tracking and Monitoring with Cargo Cloud Solutions.pptx
Real-time Tracking and Monitoring with Cargo Cloud Solutions.pptxReal-time Tracking and Monitoring with Cargo Cloud Solutions.pptx
Real-time Tracking and Monitoring with Cargo Cloud Solutions.pptxRTS corp
 
Sending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdfSending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdf31events.com
 
What’s New in VictoriaMetrics: Q1 2024 Updates
What’s New in VictoriaMetrics: Q1 2024 UpdatesWhat’s New in VictoriaMetrics: Q1 2024 Updates
What’s New in VictoriaMetrics: Q1 2024 UpdatesVictoriaMetrics
 
VK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web DevelopmentVK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web Developmentvyaparkranti
 
A healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdfA healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdfMarharyta Nedzelska
 
SoftTeco - Software Development Company Profile
SoftTeco - Software Development Company ProfileSoftTeco - Software Development Company Profile
SoftTeco - Software Development Company Profileakrivarotava
 
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...confluent
 
Post Quantum Cryptography – The Impact on Identity
Post Quantum Cryptography – The Impact on IdentityPost Quantum Cryptography – The Impact on Identity
Post Quantum Cryptography – The Impact on Identityteam-WIBU
 
Large Language Models for Test Case Evolution and Repair
Large Language Models for Test Case Evolution and RepairLarge Language Models for Test Case Evolution and Repair
Large Language Models for Test Case Evolution and RepairLionel Briand
 

Kürzlich hochgeladen (20)

Powering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data StreamsPowering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data Streams
 
Machine Learning Software Engineering Patterns and Their Engineering
Machine Learning Software Engineering Patterns and Their EngineeringMachine Learning Software Engineering Patterns and Their Engineering
Machine Learning Software Engineering Patterns and Their Engineering
 
VictoriaMetrics Anomaly Detection Updates: Q1 2024
VictoriaMetrics Anomaly Detection Updates: Q1 2024VictoriaMetrics Anomaly Detection Updates: Q1 2024
VictoriaMetrics Anomaly Detection Updates: Q1 2024
 
OpenChain Education Work Group Monthly Meeting - 2024-04-10 - Full Recording
OpenChain Education Work Group Monthly Meeting - 2024-04-10 - Full RecordingOpenChain Education Work Group Monthly Meeting - 2024-04-10 - Full Recording
OpenChain Education Work Group Monthly Meeting - 2024-04-10 - Full Recording
 
Patterns for automating API delivery. API conference
Patterns for automating API delivery. API conferencePatterns for automating API delivery. API conference
Patterns for automating API delivery. API conference
 
SAM Training Session - How to use EXCEL ?
SAM Training Session - How to use EXCEL ?SAM Training Session - How to use EXCEL ?
SAM Training Session - How to use EXCEL ?
 
The Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptx
The Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptxThe Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptx
The Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptx
 
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
 
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
 
Comparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdfComparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdf
 
Best Angular 17 Classroom & Online training - Naresh IT
Best Angular 17 Classroom & Online training - Naresh ITBest Angular 17 Classroom & Online training - Naresh IT
Best Angular 17 Classroom & Online training - Naresh IT
 
Real-time Tracking and Monitoring with Cargo Cloud Solutions.pptx
Real-time Tracking and Monitoring with Cargo Cloud Solutions.pptxReal-time Tracking and Monitoring with Cargo Cloud Solutions.pptx
Real-time Tracking and Monitoring with Cargo Cloud Solutions.pptx
 
Sending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdfSending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdf
 
What’s New in VictoriaMetrics: Q1 2024 Updates
What’s New in VictoriaMetrics: Q1 2024 UpdatesWhat’s New in VictoriaMetrics: Q1 2024 Updates
What’s New in VictoriaMetrics: Q1 2024 Updates
 
VK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web DevelopmentVK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web Development
 
A healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdfA healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdf
 
SoftTeco - Software Development Company Profile
SoftTeco - Software Development Company ProfileSoftTeco - Software Development Company Profile
SoftTeco - Software Development Company Profile
 
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
 
Post Quantum Cryptography – The Impact on Identity
Post Quantum Cryptography – The Impact on IdentityPost Quantum Cryptography – The Impact on Identity
Post Quantum Cryptography – The Impact on Identity
 
Large Language Models for Test Case Evolution and Repair
Large Language Models for Test Case Evolution and RepairLarge Language Models for Test Case Evolution and Repair
Large Language Models for Test Case Evolution and Repair
 

Progressive Web Apps with LitHTML (BucharestJS Meetup)

  • 2. What are P.W.A.? Progressive Web Apps are websites built using web technologies but act and feel like an app.
  • 3. Why P.W.A.? “Progressive Web Apps are a new way to deliver amazing user experience on the web” - Google
  • 4.
  • 5. User onboarding study case: “Every step in an onboarding flow costs 20% of users (on average)” https://medium.com/gabor/every-step-costs-you-20-of-users-b613a804c329
  • 6. Quick comparison: App vs PWA (Native) User flow: - find the app - install the app - open - use - share (PWA) User flow: - immediately use the web app - prompt to install upon return
  • 7. Quick comparison: App vs PWA Native: - native apps with push notifications retain 30% more users than native apps without - a user is more likely to reopen a mobile application than a website PWA: - have push notifications - can be installed
  • 8. PWA characteristics 1. Loads quickly (app shell) 2. Cross device (responsive UI) 3. Offline (service workers) 4. Installable (app manifest) 5. Engaging (push notification)
  • 9. 1. Loads quickly (app shell) The key feature is to progressively load the app. Initially, we load an empty app shell with a loader. Afterwards, we lazy load the content.
  • 10. PWA characteristics 1. Loads quickly (app shell) 2. Cross device (responsive UI) 3. Offline (service workers) 4. Installable (app manifest) 5. Engaging (push notification)
  • 11. 2. Cross device (responsive UI) Progressive Web Apps run on any device within a browser engine. The user interface can scale accordingly using Responsive Web Design techniques.
  • 12. PWA characteristics 1. Loads quickly (app shell) 2. Cross device (responsive UI) 3. Offline (service workers) 4. Installable (app manifest) 5. Engaging (push notification)
  • 13. 3. Offline (service workers) Progressive Web Apps can run offline with the help of Service Workers (SW).
  • 14. 3. Offline (service workers) Service Worker (SW): - it is a script - it runs in the background, separate from the webpage - it can synchronize offline content - it has a lifecycle Service Workers require a server with HTTPS
  • 15.
  • 16. 3. Offline (service workers) Service Workers generators: - sw-precache https://github.com/GoogleChromeLabs/sw-precache - workbox https://developers.google.com/web/tools/workbox/ Or, we can build a sw from scratch: https://developer.mozilla.org/en-US/docs/Web/API/Service _Worker_API
  • 17. PWA characteristics 1. Loads quickly (app shell) 2. Cross device (responsive UI) 3. Offline (service workers) 4. Installable (app manifest) 5. Engaging (push notification)
  • 18. 4. Installable (app manifest) Progressive Web Apps can be installed with the help of a manifest. https://developers.google.com/web/fundamentals/web-app-manifest/
  • 19. 4. Installable (app manifest) <link rel="manifest" href="./manifest.json"> { "name": "Proof of Concept: Polymer 3 Progressive Web App", "short_name": "PoC: PWA", "description": "a demo of a progressive web app", "icons": [ { "src": "assets/android-launchericon-144-144.png", "sizes": "144x144", "type": "image/png" }, … ], "start_url": "/", "display": "standalone", "orientation": "portrait", "background_color": "#FE7A22", "theme_color": "#FE7A22" } name: defines how the application will be listed short_name: in Chrome for Android, it is the name to accompany the icon on the home screen description: general description of the app icons: array of images serving as a set of icons and splash screens start_url: starting URL of the application display: defines the default display mode (fullscreen, standalone, minimal-ui, browser) orientation: portrait or landscape theme_color: on Android, status bar color background_color: background color of the app; in Chrome, also background color of the splashscreen
  • 20. 4. Installable (app manifest) There is an alternative to the manual declarations: PWACompat. PWACompat is a library that will generate the meta tags. <link rel="manifest" href="manifest.webmanifest"> <!-- include PWACompat _after_ your manifest → <script async src="https://cdn.jsdelivr.net/npm/pwacompat@2.0.6/pwacompat.min.js" integrity="sha384-GOaSLecPIMCJksN83HLuYf9FToOiQ2Df0+0ntv7ey8zjUHESXhthwvq9hXAZTifA" crossorigin="anonymous"></script> ! Both manifest.json and manifest.webmanifest seem to work just fine with PWAcompat. https://github.com/GoogleChromeLabs/pwacompat https://www.npmjs.com/package/pwacompat
  • 21.
  • 22. PWA characteristics 1. Loads quickly (app shell) 2. Cross device (responsive UI) 3. Offline (service workers) 4. Installable (app manifest) 5. Engaging (push notification)
  • 23. 5. Engaging (push notifications) Push notifications were initially available only in native apps. A user would still receive web push notifications even if the PWA is not open in a browser tab, and even if the browser is closed.
  • 24. 5. Engaging (push notifications) The PWA will ask the user for permissions to display notifications. The PWA also needs to be subscribed to a Push server, in order to receive the notifications. Each browser vendor has his own Push server.
  • 25.
  • 27. PWA characteristics 1. Loads quickly (app shell) 2. Cross device (responsive UI) 3. Offline (service workers) 4. Installable (app manifest) 5. Engaging (push notification)
  • 29. DEMO PWA Installation MacOS: https://vimeo.com/320142145 PWA notifications MacOS: https://vimeo.com/320142268 PWA offline (SW) MacOS: https://vimeo.com/320141344 PWA iOS: https://vimeo.com/320148762 https://razvan-rosu.github.io/demo-polymer3-pwa/
  • 30. Important mentions: In March 2018, Google announced .app TLD for PWAs https://get.app/ In March 2018, iOS started supporting PWAs. (Probably since then) the App Store allows PWAs https://medium.com/@firt/progressive-web-apps-on-ios-are-here-d00430dee3a7 In June 2018, Microsoft started allowing PWAs in the Microsoft Store https://docs.microsoft.com/en-us/microsoft-edge/progressive-web-apps/microsoft-stor e In January 2019, Google started allowing PWAs in the Google Play Store https://medium.com/@firt/google-play-store-now-open-for-progressive-web-apps-ec6f3c6ff3cc
  • 32. App structure: index.html app-core.js custom-header.js speakers-list.js talks-list.js custom-footer.js logo-component.js speaker-card.js talk-card.js installer-component.js
  • 33. Basic component w/ LitElement import {LitElement, html} from '@polymer/lit-element'; class LogoComponent extends LitElement { constructor() { super(); } static get properties() { return {...}; } render() { return html` <style>...</style> <a class="LogoComponent" href=${this.logourl}> <img class="LogoComponent-image" src=${this.imageurl} alt=${this.imagealt} title=${this.imagetitle}> </a> ` } } customElements.define('logo-component', LogoComponent);
  • 34. Child components and Lit directives import {LitElement, html} from '@polymer/lit-element'; import {repeat} from 'lit-html/directives/repeat.js'; import './photo-card.js'; ... render() { return html` <style></style> <ul class="PhotographerCardList"> ${repeat(this.photographers, i => html` <li class="PhotographerCardList-item"> <photographer-card id="${i.id}" name="${i.name}" phone="${i.phone}"></photographer-card> </li> `)} </ul> ` }
  • 35. Binding to attributes constructor() { super(); this._clickMethod = this._clickMethod.bind(this); } _clickMethod(number) { // GET albums fetch(`https://jsonplaceholder.typicode.com/posts?userId=${number}`) .then((r) => { if (!r.ok) { throw Error(r.statusText); } return r; }) .then((r) => r.json()) .then((r) => {window.__TALKS__ = r}) .then(() => { const event = new CustomEvent('injectTalks', { bubbles: true, composed: true }); window.dispatchEvent(event); }) .catch(function (error) { console.log('failed to load talks, error); }); } <button class="Speaker_c2a" type="button" @click="${this._clickMethod.bind(null, this.id)}">View talks (id: #${this.id})</button>
  • 38. References ● PWA examples: https://pwa.rocks ● PWA: https://developers.google.com/web/progressive-web-apps/ ● Workbox: https://developers.google.com/web/tools/workbox/ ● PWAcompat: https://developers.google.com/web/updates/2018/07/pwacompat ● LitHTML: https://lit-html.polymer-project.org/ ● Demo: https://razvan-rosu.github.io/demo-polymer3-pwa/