Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Natura Meet Up PWA - Offline first
Search
Marcus Ortense
September 12, 2019
Programming
0
73
Natura Meet Up PWA - Offline first
Marcus Ortense
September 12, 2019
Tweet
Share
More Decks by Marcus Ortense
See All by Marcus Ortense
Analytics para Devs
ortense
1
93
Concrete on Beer JavaScript - Offline first
ortense
0
130
Escrevendo javascript testável
ortense
1
170
Serverless
ortense
0
82
Talk - let, const & arrow functions
ortense
0
58
Talk - JavaScript Isomórfico
ortense
0
74
Desenvolvimento vs Conversão
ortense
2
110
Other Decks in Programming
See All in Programming
Tinkerbellから学ぶ、Podで DHCPをリッスンする手法
tomokon
0
150
認証・認可の基本を学ぼう後編
kouyuume
0
260
20251212 AI 時代的 Legacy Code 營救術 2025 WebConf
mouson
0
230
Canon EOS R50 V と R5 Mark II 購入でみえてきた最近のデジイチ VR180 事情、そして VR180 静止画に活路を見出すまで
karad
0
140
The Past, Present, and Future of Enterprise Java
ivargrimstad
0
510
著者と進める!『AIと個人開発したくなったらまずCursorで要件定義だ!』
yasunacoffee
0
170
PostgreSQLで手軽にDuckDBを使う!DuckDB&pg_duckdb入門/osc25hi-duckdb
takahashiikki
0
210
Findy AI+の開発、運用におけるMCP活用事例
starfish719
0
1.9k
從冷知識到漏洞,你不懂的 Web,駭客懂 - Huli @ WebConf Taiwan 2025
aszx87410
2
3.2k
Kotlin Multiplatform Meetup - Compose Multiplatform 외부 의존성 아키텍처 설계부터 운영까지
wisemuji
0
150
Python札幌 LT資料
t3tra
7
1.1k
Cap'n Webについて
yusukebe
0
160
Featured
See All Featured
Large-scale JavaScript Application Architecture
addyosmani
515
110k
Lightning talk: Run Django tests with GitHub Actions
sabderemane
0
94
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
48
9.8k
AI: The stuff that nobody shows you
jnunemaker
PRO
1
37
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
37
6.2k
職位にかかわらず全員がリーダーシップを発揮するチーム作り / Building a team where everyone can demonstrate leadership regardless of position
madoxten
54
48k
Typedesign – Prime Four
hannesfritz
42
2.9k
Agile Actions for Facilitating Distributed Teams - ADO2019
mkilby
0
98
Collaborative Software Design: How to facilitate domain modelling decisions
baasie
0
100
Paper Plane
katiecoart
PRO
0
44k
<Decoding/> the Language of Devs - We Love SEO 2024
nikkihalliwell
0
100
AI Search: Implications for SEO and How to Move Forward - #ShenzhenSEOConference
aleyda
1
1k
Transcript
– OFFLINE FIRST meetup
Chapter Manager @ Concrete
Tech Lead @ Social Selling
– OFFLINE FIRST meetup Por que isso é importante?
– Qual a realidade da internet hoje?
– 40% dos usuários abandonam o site após 3 segundos
de espera. fonte: Dynatrace / Gomez.com (http://bit.ly/29jzPRc)
– Amazon identificou que cada 100 milissegundos de espera representa
a queda de 1% nas vendas fonte: Amazon / Findory (http://bit.ly/2kd4UOp)
– Em 2019 a cobertura de 3G no Brasil chegou
a 97.6%, atingindo 5438 municípios. fonte: Operadoras (http://bit.ly/2kaUSNC)
– 33% dos brasileiros acessa a internet apenas por dispositivos
móveis fonte: IBGE (http://bit.ly/2k8rFTs)
– 76% dos brasileiros utiliza banda larga móvel, sendo que
17% não possui acesso a outro tipo de conexão. fonte: IBGE (http://bit.ly/2k8rFTs)
– Brasil ocupa a 50ª posição no ranking de velocidade
de internet móvel. fonte: IBGE (http://bit.ly/2k8rFTs)
– A média de velocidade de internet móvel no Brasil
é 13mbs, abaixo da média global de 17mbs. fonte: IBGE (http://bit.ly/2k8rFTs)
– Mais de 70% dos acessos ao rede vem de
dispositivos móveis. fonte: Rede Natura
– E o que isso tem a ver com PWA?
None
None
None
– Progressive Web Apps é uma experiência do usuário ao
alcance da web confiável, rápida e engajante. fonte: Google Developers (http://bit.ly/2kI5J1J)
– Progressive Web Apps é uma experiência do usuário ao
alcance da web confiável, rápida e engajante. fonte: Google Developers (http://bit.ly/2kI5J1J)
– Carregue instantaneamente e nunca mostre o downasaur, mesmo em
condições de rede incertas. fonte: Google Developers (http://bit.ly/2kI5J1J)
– Mas como?!
– Tipo de conexão console.log(navigator.connection) NetworkInformation { downlink: 10, //
Estimativa da banda em MB/S effectiveType: '4g', // Tipo de conexão slow-2g, 2g, 3g', or 4g rtt: 0, // round-trip time em milissegundo saveData: false, // O usuário utiliza economia de dados onchange: null, // Event Handler }
– Online/Offline window.addEventListener('online', (e) => console.log('Online ')); window.addEventListener('offline', (e) =>
console.log('Offline ')); if(window.navigator.onLine) { console.log('Online ') } else { console.log('Offline ') }
– Service Workers INSTALL ACTIVATED ERROR IDLE TERMINATED FETCH /
MESSAGE fonte: Google Developers | Web Fundamentals (http://bit.ly/2kxftft)
if('serviceWorker' in navigator) { console.log('ServiceWorker é suportado neste navegador ')
} else { console.log('ServiceWorker não é suportado ') }
navigator.serviceWorker.register('assets/sw.js') .then(reg => console.info('registered ', reg)) .catch(err => console.error('error registering
', err))
navigator.serviceWorker.register('assets/sw.js') .then((reg) => { if(reg.installing) { console.log('Instalando ') } else
if(reg.waiting) { console.log('Instalado ✅') } else if(reg.active) { console.log('SeviceWorker ativo ') } })
navigator.serviceWorker.register('assets/sw.js') .then((reg) => { const sw = reg.installing reg.addEventListener('updatefound', ()
=> { sw.addEventListener('statechange', () => { console.log(`Status atualizado para ${sw.state} `) }) }) })
const PRE_CACHE_URL = [ '/index.html', '/styles/main.css', '/script/main.js' ]; self.addEventListener('install', (event)
=> { event.waitUntil(caches.open('cache-app-v1') .then((cache) => cache.addAll(PRE_CACHE_URL))) })
self.addEventListener('fetch', (event) => { event.respondWith( caches.match(event.request).then((response) => { if(response) return
response return fetch(event.request) }) ) })
event.respondWith( caches.match(event.request).then((response) => { if(response) return response return fetch(event.request) .then(response
=> { caches.open('cache-app-v1').then(cache => cache.put(event.request, response.clone())) return response }) }) .catch(() => caches.match('fallback.html')))
– CONCLUSÃO
– Offline first é possível, faz sentido, pode ser feito
hoje e cria uma a experiência mais confiável para o seu usuário.
OBRIGADO! @marcusortense
[email protected]
bit.ly/2kypFEv