progressive web apps o melhor da web, aqconrio.com/.../progressive-webapps-sergio.pdf ·
Post on 20-May-2020
0 Views
Preview:
TRANSCRIPT
PROGRESSIVE WEB APPS
O MELHOR DA WEB, APPF
ICAD
A
@sergio_caelumsergiolopes.org
WEB vs APP
PROGRESSIVE WEB APPS
PROGRESSIVE WEB APPS
HTML semântico
<!doctype html><html lang="pt-br"><head> <title>Shopping</title></head><body> <main class="home">
<h1>O Shopping</h1>
<div class="collection"><a href="lojas.html">
Lojas & Restaurantes</a>
<a href="pagar.html">Pagar estacionamento
</a></div>
</main></body></html>
URIs
<!doctype html><html lang="pt-br"><head> <title>Shopping</title></head><body> <main class="home">
<h1>O Shopping</h1>
<div class="collection"><a href="lojas.html">
Lojas & Restaurantes</a>
<a href="pagar.html">Pagar estacionamento
</a></div>
</main></body></html>
https://sergiolopes.github.io/shopping/https://sergiolopes.github.io/shopping/lojas.htmlhttps://sergiolopes.github.io/shopping/pagar-estacionamento.htmlhttps://sergiolopes.github.io/shopping/loja-adidas.htmlhttps://sergiolopes.github.io/shopping/loja-tip-top.html...
URIs
https://sergiolopes.github.io/shopping/https://sergiolopes.github.io/shopping/lojas.htmlhttps://sergiolopes.github.io/shopping/pagar-estacionamento.htmlhttps://sergiolopes.github.io/shopping/loja-adidas.htmlhttps://sergiolopes.github.io/shopping/loja-tip-top.html...
HTTPS
PROGRESSIVE WEB APPS
PROGRESSIVE WEB APPS
VISUAL APPFICADO
v
SPA AJAX
SPA AJAX
$('body').on('click', 'a', function(event){$('.container').load(this.href + ' .conteudo');event.preventDefault();
});
transform: translate3d(-100%,0,0);transition: transform 600ms ease-out;
transform: scale(0);transition: transform 500ms;
HIST ORY
HIST ORY
$('body').on('click', 'a', function(event){
$('.container').load(this.href + ' .conteudo');event.preventDefault();
});
HIST ORY
$('body').on('click', 'a', function(event){window.history.pushState({}, '', this.href);$('.container').load(this.href + ' .conteudo');event.preventDefault();
});
window.onpopstate = function(event) {$('.container').load(location.href + ' .conteudo');
};
OFF LINE
OFF LINE
CACHE MANIFEST
CACHE:index.htmllojas.htmlcss/main.cssimg/entrada.jpgjs/main.jsjs/vendor/jquery.min.jsloja-adidas.html
NETWORK:*
<html manifest="appcache.manifest">
HW
Quagga.init({ inputStream : { name : "Live", type : "LiveStream" }, decoder : { readers : ["code_128_reader"] }}, function() { Quagga.start();});
Quagga.onDetected(function(result) { var code = result.codeResult.code; alert('Código: ' + code);});
QuaggaJS
HW
THEME COLOR
<meta name="theme-color" content="#F77F00">
PROGRESSIVE WEB APPS
<!DOCTYPE html><html><head><script>navigator.serviceWorker.register('worker.js');
</script></head><body><h1>Página offline</h1>
</body></html>
SERVICE WORKERS
this.onfetch = function(event) {
console.log(event.request.url);
};
SERVICE WORKERS
this.onfetch = function(event) {event.respondWith(
new Response("<h1>Página offline!</h1>") );};
SERVICE WORKERS
this.onfetch = function(event) {event.respondWith(
new Response("<h1>Página offline!</h1>") );};
SERVICE WORKERS
this.oninstall = function(event) {console.log('instalou');
};
caches.open('aplicacao').then(function(cache) { return cache.addAll([ '/index.html', '/style.css', '/logo.png', '/lojas.html' ]); })
SERVICE WORKERS
this.oninstall = function(event){ event.waitUntil( caches.open('aplicacao').then(function(cache) { return cache.addAll([ '/index.html', '/style.css', '/logo.png', '/lojas.html' ]); }) );};
SERVICE WORKERS
this.onfetch = function(event) { event.respondWith( caches.match(event.request) );};
SERVICE WORKERS
progressive enhancement
if ('serviceWorker' in navigator) {
}
SERVICE WORKERS
<meta name="apple-mobile-web-app-capable" content="yes"><meta name="apple-mobile-web-app-title" content="Shopping"><link rel="apple-touch-icon-precomposed" href="img/icon.png">
INSTALÁVEL iOS
INSTALÁVEL iOS
<link rel="manifest" href="manifest.json">
INSTALÁVEL Web Manifest
INSTALÁVEL Web Manifest
{ "short_name": "Shopping", "name": "Shopping App Demo",
}
INSTALÁVEL Web Manifest
{ "short_name": "Shopping", "name": "Shopping App Demo", "icons": [ { "src": "img/icon.png", "sizes": "192x192", "type": "image/png" } ],
}
INSTALÁVEL Web Manifest
{ "short_name": "Shopping", "name": "Shopping App Demo", "icons": [ { "src": "img/icon.png", "sizes": "192x192", "type": "image/png" } ], "start_url": "index.html",
}
INSTALÁVEL Web Manifest
{ "short_name": "Shopping", "name": "Shopping App Demo", "icons": [ { "src": "img/icon.png", "sizes": "192x192", "type": "image/png" } ], "start_url": "index.html", "orientation": "portrait",
}
INSTALÁVEL Web Manifest
{ "short_name": "Shopping", "name": "Shopping App Demo", "icons": [ { "src": "img/icon.png", "sizes": "192x192", "type": "image/png" } ], "start_url": "index.html", "orientation": "portrait", "display": "standalone"}
INSTALÁVEL Web Manifest
INSTALL BANNERS
PROGRESSIVE WEB APPS
NOTIFICATIONSNotification.requestPermission(function(){ new Notification('Pagamento confirmado', { icon: 'img/icon.png', body: 'Saída liberada até 15h45' }); });
NOTIFICATIONSNotification.requestPermission(function(){ navigator.serviceWorker.ready.then(function(registration){ registration.showNotification('Pagamento confirmado', { icon: 'img/icon.png', body: 'Saída liberada até 15h45' }); });});
NOTIFICATIONS
NOTIFICATIONSNotification.requestPermission(function(){ navigator.serviceWorker.ready.then(function(registration){ registration.showNotification('Pagamento confirmado', { icon: 'img/icon.png', body: 'Saída liberada até 15h45' }); });});
self.addEventListener('notificationclick', function(event) { clients.openWindow('/timer.html');});
PUSH NOTIFICATIONS
navigator.serviceWorker.ready.then(function(reg) { reg.pushManager.subscribe({userVisibleOnly: true}) .then(function(subscription) { // descobre servidor Push });
self.addEventListener('push', function(event) { event.waitUntil( self.registration.showNotification(...) );});
BACKGROUND SYNC GEOFENCING ALARMES TEMPORAIS
GEOLOCALIZAÇÃO VIBRAÇÃO CÂMERA MICROFONE BATERIA NET INFO AUTOCOMPLETE
LINKÁVEL RESPONSIVA SEGURA OFFLINE APPY ENGAJÁVEL INSTALÁVEL
PROGRESSIVE WEB APPS
OBRIGADO!
sergiolopes.org @sergio_caelum
https://sergiolopes.github.io/shopping/
top related