SlideShare ist ein Scribd-Unternehmen logo
1 von 48
Stop the Internet,
I want to go offline
Boyan Mihaylov
@bmihaylov
@bmihaylov | BuildStuff 2016 2
We live in a connected world
https://c1app.wordpress.com/2015/02/02/mobile-apps-a-simple-overview/social-media-network-connection-and-communication-in-the-global_z1j0gjo_/
@bmihaylov | BuildStuff 2016 3
SLOWEST FASTEST
Internet speed worldwide
https://telegraphtravelmaps.carto.com/viz/b0a43e76-40bf-11e5-bfd4-0e6e1df11cbf/public_map
Working while travelling
@bmihaylov | BuildStuff 2016 4
https://www.wired.com/wp-content/uploads/blogs/wiredenterprise/wp-content/uploads/2013/09/docker-jungle.jpg
Working while travelling
@bmihaylov | BuildStuff 2016 5
https://www.selectlegal.co.uk/wp-content/uploads/2015/07/Man-on-train.jpg
@bmihaylov | BuildStuff 2016 6
@bmihaylov | BuildStuff 2016 7
@bmihaylov | BuildStuff 2016 8
5
Principles
for great
offline
experience
@bmihaylov | BuildStuff 2016 9
@bmihaylov | BuildStuff 2016 10
#1
Degrade
gracefully as
the network
connection
changes
@bmihaylov | BuildStuff 2016 11
#2
Provide clear
feedback
about the my
actions
@bmihaylov | BuildStuff 2016 12
#3
Give me
constant
access to the
content I
care about
@bmihaylov | BuildStuff 2016 13
#4
Content is
mutable, no
matter if I am
online or
offline
@bmihaylov | BuildStuff 2016 14
#5
Remember
my recent
activity for
me
@bmihaylov | BuildStuff 2016 15
Traditional
caching
approaches
@bmihaylov | BuildStuff 2016 16
HTTP Headers
@bmihaylov | BuildStuff 2016 17
GET /build-stuff.html HTTP/1.1
…
HTTP 1/1 200 OK
Cache-Control: public, max-age=86400
Expires: Tue, 22 Nov 2016, 20:00:00 GMT
Last-Modified: Wed, 16 Nov 2016, 08:00:00 GMT
ETag: “5485fac7-ae74”
…
Request
Response
Resource versioning
@bmihaylov | BuildStuff 2016 18
…
<link href="/css/site.css" rel="stylesheet" />
<link href="/css/baske.css?v=2" rel="stylesheet" />
…
<script src="/js/moment-2.8.3.js"></script>
<script src="/js/prettyCheckable.js?v=1"></script>
<script src="/js/customSelect.js?v=1"></script>
<script src="/js/app/basket.js?v=2"></script>
<script src="/js/app/BasketController.js?v=2"></script>
…
<script src="/js/app-bundle.js?v=53e32af"></script>
…
Cookies
@bmihaylov | BuildStuff 2016 19
GET /build-stuff.html HTTP/1.1
…
HTTP 1/1 200 OK
Set-Cookie: i-am-cool=true;
…
#1 Request
#1 Response
GET /build-stuff.html HTTP/1.1
Cookie: i-am-cool=true;
…
#2 Request
3rd-party plug-ins
@bmihaylov | BuildStuff 2016 20
@bmihaylov | BuildStuff 2016 21
Application cache
@bmihaylov | BuildStuff 2016 22
CACHE MANIFEST
# 2016-11-18 v1
CACHE:
welcome.html
css/style.css
img/title.png
NETWORK:
*
FALLBACK:
/ offline.html
manifest.appcache Usage
<html manifest="manifest.appcache">
…
– Caching the manifest file?
– Not flexible enough
– Hard to debug
– Deprecated
+ Good browser support
Web storage
@bmihaylov | BuildStuff 2016 23
localStorage.setItem("conf", "BuildStuff");
const conf = localStorage.getItem("conf");
localStorage.removeItem("conf");
localStorage.clear();
sessionStorage.setItem("mySession", "offline");
+ Key-value store
+ Per session or permanent
+ Cross-browser support
– Serialization / deserialization
– No transactions
– Limited space
Web SQL database
@bmihaylov | BuildStuff 2016 24
+ SQLite in the browser
+ Relational DB advantages
– Minimal browser support
– Deprecated
const db = openDatabase("mydb", "1.0", "Test DB", 50*1024*2014);
db.transaction(tx => {
tx.executeSql("CREATE TABLE IT NOT EXISTS Conf (id unique, name)");
tx.executeSql("INSERT INTO Conf VALUES (1, 'BuildStuff'");
});
indexedDB
@bmihaylov | BuildStuff 2016 25
+ Storage of significant amounts
of structured data (+ blobs)
+ Transactional support
+ (Good) browser support
const dbRequest = indexedDB.open("ConfDB");
dbRequest.onupgradeneeded = () => {
dbRequest.result
.createObjectStore("conf", { keyPath: "id" })
.put({ id: 1, name: "BuildStuff" });
};
dbRequest.onsuccess = () => {
const getRequest = dbRequest.result
.objectStore("conf").get(1);
getRequest.onsuccess = () => { /* getRequest.result.name */ };
};
– Complex for simple scenarios
FileSystem API
@bmihaylov | BuildStuff 2016 26
+ A sandboxed file system
+ Store binary content
– May ask for extra quota
– Only supported in Chrome
– Non-standard
window.webkitStorageInfo
.requestQuota(PERSISTENT, 1024*1024, (quota) => {
window.requestFileSystem(PERSISTENT, quota, onInit, onError);
}, onError);
function onInit(fs) {
fs.root.getFile(
"log.txt", { create: true, exclusive: true },
(fileEntry) => { /* fileEntry.name */ },
onError);
}
Service Worker
A script running in the background
Even when the browser is closed
Acts as a proxy between the browser and
the network (when available)
Programmatic and controllable
Cache API
27@bmihaylov | BuildStuff 2016
Service Worker lifecycle
@bmihaylov | BuildStuff 2016 28
Installing Activated Idle
Fetch /
message
Terminated
Error
Service Worker – register
@bmihaylov | BuildStuff 2016 29
<script>
if ("serviceWorker" in navigator) {
navigator.serviceWorker.register("app-install.js")
.then(function() {
console.log("Service worker has been installed");
}, function(error) {
console.log("Oops!", error);
});
} else {
console.log("No service workers support for this browser");
}
</script>
Service Worker – install
@bmihaylov | BuildStuff 2016 30
const CACHE_NAME = "app.cache.v1";
this.addEventListener("install", (event) => {
event.waitUntil(
caches.open(CACHE_NAME).then((cache) => {
return cache.addAll([
"/index.html",
"/css/style.css",
"/js/app.js"
]);
});
);
});
…
app-install.js
Service Worker – fetch
@bmihaylov | BuildStuff 2016 31
app-install.js
…
this.addEventListener("fetch", (event) => {
event.respondWith(
caches.match(event.request).then((response) => {
return response || fetch(event.request);
});
);
});
…
Service Worker specifics
HTTPs only
Asynchronous, promise-based
Not working with localStorage
indexedDB only
No access to DOM
Isn’t tied to a particular page
32@bmihaylov | BuildStuff 2016
Caching
strategies
using
service
workers
@bmihaylov | BuildStuff 2016 33
https://jakearchibald.com/2014/offline-cookbook/
Network only
@bmihaylov | BuildStuff 2016 34
www.
1 2
3
Scenarios
• Analytics requests
• Non-GET requests
Cache only
@bmihaylov | BuildStuff 2016 35
www.
1 2
3
Scenarios
• The static part of your app
Cache, falling back to network
@bmihaylov | BuildStuff 2016 36
www.
1
2
3
4
Scenarios
• The majority of requests
when building offline-first
app
Network, falling back to cache
@bmihaylov | BuildStuff 2016 37
www.
1
3
2
4
Scenarios
• Online users will always
get the latest content
• Offline users will get older
content
Cache & update
@bmihaylov | BuildStuff 2016 38
www.
1
2
2
3
4
Scenarios
• You don’t mind showing
old content for a while
Cache, update, refresh
@bmihaylov | BuildStuff 2016 39
www.
1
2
2
3
4
4
Scenarios
• Content that changes often
(fx., game score, social
media timeline)
Network & cache race
@bmihaylov | BuildStuff 2016 40
www.
1
2
2
3
3
Scenarios
• Small “non-important”
assets
• Where performance
is vital
Beyond typical scenarios
@bmihaylov | BuildStuff 2016 41
Network status Background sync Push notifications
Is Service Worker ready?
@bmihaylov | BuildStuff 2016 42
11 14 10
9.1
TP
10
9.3
all
4.4
4.4.4
49
50
51
52
54
53
55
56
57
52
51
49
41
42
43
53 53
IE Edge Firefox Chrome Safari Opera iOS Safari
Opera
Mini
Android
Browser
Chrome
for
Android
Myths about
working
offline
@bmihaylov | BuildStuff 2016 43
Myth #1:
4G is
everywhere
@bmihaylov | BuildStuff 2016 44
Myth #2:
Offline
scenarios
are rare
@bmihaylov | BuildStuff 2016 45
Myth #3:
Local data
is used only
for offline apps
@bmihaylov | BuildStuff 2016 46
Myth #4:
Current
web standards
are of no use
@bmihaylov | BuildStuff 2016 47
48
Thank you, BuildStuff!
@bmihaylov | BuildStuff 2016
hey@boyan.in
@bmihaylov
After party

Weitere ähnliche Inhalte

Was ist angesagt?

Дмитрий Лемешко. Comaqa Spring 2018. Continuous mobile automation in build pi...
Дмитрий Лемешко. Comaqa Spring 2018. Continuous mobile automation in build pi...Дмитрий Лемешко. Comaqa Spring 2018. Continuous mobile automation in build pi...
Дмитрий Лемешко. Comaqa Spring 2018. Continuous mobile automation in build pi...COMAQA.BY
 
#CodefreshLive Event
#CodefreshLive Event#CodefreshLive Event
#CodefreshLive EventCodefresh
 
Enhance Your Kubernetes CI/CD Pipelines With GitLab & Open Source
Enhance Your Kubernetes CI/CD Pipelines With GitLab & Open SourceEnhance Your Kubernetes CI/CD Pipelines With GitLab & Open Source
Enhance Your Kubernetes CI/CD Pipelines With GitLab & Open SourceNico Meisenzahl
 
BizTalk ALM (Toon Vanhoutte @ Integration Monday)
BizTalk ALM (Toon Vanhoutte @ Integration Monday)BizTalk ALM (Toon Vanhoutte @ Integration Monday)
BizTalk ALM (Toon Vanhoutte @ Integration Monday)Codit
 
C# development workflow @ criteo
C# development workflow @ criteoC# development workflow @ criteo
C# development workflow @ criteoIbrahim Abubakari
 
Why reinvent the wheel at Criteo?
Why reinvent the wheel at Criteo? Why reinvent the wheel at Criteo?
Why reinvent the wheel at Criteo? Criteolabs
 
Moving Kentico Cms To The Azure
Moving Kentico Cms To The AzureMoving Kentico Cms To The Azure
Moving Kentico Cms To The AzureMichal Neuwirth
 
Web And Cloud Tour 2015 - ASP.NET 5
Web And Cloud Tour 2015 -  ASP.NET 5 Web And Cloud Tour 2015 -  ASP.NET 5
Web And Cloud Tour 2015 - ASP.NET 5 Marc Rubiño
 
Overview of modern software ecosystem for big data analysis
Overview of modern software ecosystem for big data analysisOverview of modern software ecosystem for big data analysis
Overview of modern software ecosystem for big data analysisMichael Bryzek
 
[Call for code] IBM 블록체인을 활용하여 투명하게 구호기금 관리하기 - Hyperledger Fabric v1.1 by 맹개발
[Call for code] IBM 블록체인을 활용하여 투명하게 구호기금 관리하기 - Hyperledger Fabric v1.1 by 맹개발 [Call for code] IBM 블록체인을 활용하여 투명하게 구호기금 관리하기 - Hyperledger Fabric v1.1 by 맹개발
[Call for code] IBM 블록체인을 활용하여 투명하게 구호기금 관리하기 - Hyperledger Fabric v1.1 by 맹개발 Yunho Maeng
 
VueJs Workshop
VueJs WorkshopVueJs Workshop
VueJs WorkshopUnfold UI
 
GitLab London Meetup: How Containerized Pipelines and Kubernetes Can Boost Yo...
GitLab London Meetup: How Containerized Pipelines and Kubernetes Can Boost Yo...GitLab London Meetup: How Containerized Pipelines and Kubernetes Can Boost Yo...
GitLab London Meetup: How Containerized Pipelines and Kubernetes Can Boost Yo...Nico Meisenzahl
 
JS digest. October 2017
JS digest. October 2017 JS digest. October 2017
JS digest. October 2017 ElifTech
 
Asp.net visual studio 2013
Asp.net   visual studio 2013Asp.net   visual studio 2013
Asp.net visual studio 2013Tyrone Moodley
 
Why Git Sucks and you'll use it anyways
Why Git Sucks and you'll use it anywaysWhy Git Sucks and you'll use it anyways
Why Git Sucks and you'll use it anywaysCarlos Taborda
 

Was ist angesagt? (20)

Дмитрий Лемешко. Comaqa Spring 2018. Continuous mobile automation in build pi...
Дмитрий Лемешко. Comaqa Spring 2018. Continuous mobile automation in build pi...Дмитрий Лемешко. Comaqa Spring 2018. Continuous mobile automation in build pi...
Дмитрий Лемешко. Comaqa Spring 2018. Continuous mobile automation in build pi...
 
#CodefreshLive Event
#CodefreshLive Event#CodefreshLive Event
#CodefreshLive Event
 
Enhance Your Kubernetes CI/CD Pipelines With GitLab & Open Source
Enhance Your Kubernetes CI/CD Pipelines With GitLab & Open SourceEnhance Your Kubernetes CI/CD Pipelines With GitLab & Open Source
Enhance Your Kubernetes CI/CD Pipelines With GitLab & Open Source
 
Tce automation-d4
Tce automation-d4Tce automation-d4
Tce automation-d4
 
BizTalk ALM (Toon Vanhoutte @ Integration Monday)
BizTalk ALM (Toon Vanhoutte @ Integration Monday)BizTalk ALM (Toon Vanhoutte @ Integration Monday)
BizTalk ALM (Toon Vanhoutte @ Integration Monday)
 
C# development workflow @ criteo
C# development workflow @ criteoC# development workflow @ criteo
C# development workflow @ criteo
 
Why reinvent the wheel at Criteo?
Why reinvent the wheel at Criteo? Why reinvent the wheel at Criteo?
Why reinvent the wheel at Criteo?
 
Web view
Web viewWeb view
Web view
 
Moving Kentico Cms To The Azure
Moving Kentico Cms To The AzureMoving Kentico Cms To The Azure
Moving Kentico Cms To The Azure
 
Quick workflow of a nodejs api
Quick workflow of a nodejs apiQuick workflow of a nodejs api
Quick workflow of a nodejs api
 
Web And Cloud Tour 2015 - ASP.NET 5
Web And Cloud Tour 2015 -  ASP.NET 5 Web And Cloud Tour 2015 -  ASP.NET 5
Web And Cloud Tour 2015 - ASP.NET 5
 
Overview of modern software ecosystem for big data analysis
Overview of modern software ecosystem for big data analysisOverview of modern software ecosystem for big data analysis
Overview of modern software ecosystem for big data analysis
 
Jayway Web Tech Radar 2015
Jayway Web Tech Radar 2015Jayway Web Tech Radar 2015
Jayway Web Tech Radar 2015
 
[Call for code] IBM 블록체인을 활용하여 투명하게 구호기금 관리하기 - Hyperledger Fabric v1.1 by 맹개발
[Call for code] IBM 블록체인을 활용하여 투명하게 구호기금 관리하기 - Hyperledger Fabric v1.1 by 맹개발 [Call for code] IBM 블록체인을 활용하여 투명하게 구호기금 관리하기 - Hyperledger Fabric v1.1 by 맹개발
[Call for code] IBM 블록체인을 활용하여 투명하게 구호기금 관리하기 - Hyperledger Fabric v1.1 by 맹개발
 
VueJs Workshop
VueJs WorkshopVueJs Workshop
VueJs Workshop
 
GitLab London Meetup: How Containerized Pipelines and Kubernetes Can Boost Yo...
GitLab London Meetup: How Containerized Pipelines and Kubernetes Can Boost Yo...GitLab London Meetup: How Containerized Pipelines and Kubernetes Can Boost Yo...
GitLab London Meetup: How Containerized Pipelines and Kubernetes Can Boost Yo...
 
JS digest. October 2017
JS digest. October 2017 JS digest. October 2017
JS digest. October 2017
 
Sprint 67
Sprint 67Sprint 67
Sprint 67
 
Asp.net visual studio 2013
Asp.net   visual studio 2013Asp.net   visual studio 2013
Asp.net visual studio 2013
 
Why Git Sucks and you'll use it anyways
Why Git Sucks and you'll use it anywaysWhy Git Sucks and you'll use it anyways
Why Git Sucks and you'll use it anyways
 

Ähnlich wie Stop the internet, i want to go offline

Going Serverless with Azure Functions
Going Serverless with Azure FunctionsGoing Serverless with Azure Functions
Going Serverless with Azure FunctionsShahed Chowdhuri
 
Bringing JAMStack to the Enterprise
Bringing JAMStack to the EnterpriseBringing JAMStack to the Enterprise
Bringing JAMStack to the EnterpriseC4Media
 
[Serverless Meetup Tokyo #3] Serverless in Azure (Azure Functionsのアップデート、事例、デ...
[Serverless Meetup Tokyo #3] Serverless in Azure (Azure Functionsのアップデート、事例、デ...[Serverless Meetup Tokyo #3] Serverless in Azure (Azure Functionsのアップデート、事例、デ...
[Serverless Meetup Tokyo #3] Serverless in Azure (Azure Functionsのアップデート、事例、デ...Naoki (Neo) SATO
 
MySQL 8.0.17 - New Features Summary
MySQL 8.0.17 - New Features SummaryMySQL 8.0.17 - New Features Summary
MySQL 8.0.17 - New Features SummaryOlivier DASINI
 
Building a WiFi Hotspot with NodeJS: Cisco Meraki - ExCap API
Building a WiFi Hotspot with NodeJS: Cisco Meraki - ExCap APIBuilding a WiFi Hotspot with NodeJS: Cisco Meraki - ExCap API
Building a WiFi Hotspot with NodeJS: Cisco Meraki - ExCap APICisco DevNet
 
Quick and Easy Development with Node.js and Couchbase Server
Quick and Easy Development with Node.js and Couchbase ServerQuick and Easy Development with Node.js and Couchbase Server
Quick and Easy Development with Node.js and Couchbase ServerNic Raboy
 
using Mithril.js + postgREST to build and consume API's
using Mithril.js + postgREST to build and consume API'susing Mithril.js + postgREST to build and consume API's
using Mithril.js + postgREST to build and consume API'sAntônio Roberto Silva
 
Sebastian Schmidt, Rachel Myers - How To Go Serverless And Not Violate The GD...
Sebastian Schmidt, Rachel Myers - How To Go Serverless And Not Violate The GD...Sebastian Schmidt, Rachel Myers - How To Go Serverless And Not Violate The GD...
Sebastian Schmidt, Rachel Myers - How To Go Serverless And Not Violate The GD...Codemotion
 
Web 3.12: A browser to make us proud (GUADEC 2014)
Web 3.12: A browser to make us proud (GUADEC 2014)Web 3.12: A browser to make us proud (GUADEC 2014)
Web 3.12: A browser to make us proud (GUADEC 2014)Igalia
 
Front End Development for Back End Java Developers - Jfokus 2020
Front End Development for Back End Java Developers - Jfokus 2020Front End Development for Back End Java Developers - Jfokus 2020
Front End Development for Back End Java Developers - Jfokus 2020Matt Raible
 
New WSO2 Enterprise Integrator Focuses on Integration Developer Productivity
New WSO2 Enterprise Integrator Focuses on Integration Developer ProductivityNew WSO2 Enterprise Integrator Focuses on Integration Developer Productivity
New WSO2 Enterprise Integrator Focuses on Integration Developer ProductivityWSO2
 
Full Stack Development With Node.Js And NoSQL (Nic Raboy & Arun Gupta)
Full Stack Development With Node.Js And NoSQL (Nic Raboy & Arun Gupta)Full Stack Development With Node.Js And NoSQL (Nic Raboy & Arun Gupta)
Full Stack Development With Node.Js And NoSQL (Nic Raboy & Arun Gupta)Red Hat Developers
 
The SharePoint & jQuery Guide - Updated 1/14/14
The SharePoint & jQuery Guide - Updated 1/14/14The SharePoint & jQuery Guide - Updated 1/14/14
The SharePoint & jQuery Guide - Updated 1/14/14Mark Rackley
 
Now you see me... Adaptive Web Design and Development
Now you see me... Adaptive Web Design and DevelopmentNow you see me... Adaptive Web Design and Development
Now you see me... Adaptive Web Design and DevelopmentJonas Päckos
 
Supercharge your data analytics with BigQuery
Supercharge your data analytics with BigQuerySupercharge your data analytics with BigQuery
Supercharge your data analytics with BigQueryMárton Kodok
 
My way to clean android (EN) - Android day salamanca edition
My way to clean android (EN) - Android day salamanca editionMy way to clean android (EN) - Android day salamanca edition
My way to clean android (EN) - Android day salamanca editionChristian Panadero
 
OSCON 2011 CouchApps
OSCON 2011 CouchAppsOSCON 2011 CouchApps
OSCON 2011 CouchAppsBradley Holt
 
Expedite the development lifecycle with MongoDB and serverless - DEM02 - Sant...
Expedite the development lifecycle with MongoDB and serverless - DEM02 - Sant...Expedite the development lifecycle with MongoDB and serverless - DEM02 - Sant...
Expedite the development lifecycle with MongoDB and serverless - DEM02 - Sant...Amazon Web Services
 
MongoDB.local Atlanta: MongoDB Stitch Tutorial
MongoDB.local Atlanta: MongoDB Stitch TutorialMongoDB.local Atlanta: MongoDB Stitch Tutorial
MongoDB.local Atlanta: MongoDB Stitch TutorialMongoDB
 

Ähnlich wie Stop the internet, i want to go offline (20)

Going Serverless with Azure Functions
Going Serverless with Azure FunctionsGoing Serverless with Azure Functions
Going Serverless with Azure Functions
 
Bringing JAMStack to the Enterprise
Bringing JAMStack to the EnterpriseBringing JAMStack to the Enterprise
Bringing JAMStack to the Enterprise
 
[Serverless Meetup Tokyo #3] Serverless in Azure (Azure Functionsのアップデート、事例、デ...
[Serverless Meetup Tokyo #3] Serverless in Azure (Azure Functionsのアップデート、事例、デ...[Serverless Meetup Tokyo #3] Serverless in Azure (Azure Functionsのアップデート、事例、デ...
[Serverless Meetup Tokyo #3] Serverless in Azure (Azure Functionsのアップデート、事例、デ...
 
MySQL 8.0.17 - New Features Summary
MySQL 8.0.17 - New Features SummaryMySQL 8.0.17 - New Features Summary
MySQL 8.0.17 - New Features Summary
 
Building a WiFi Hotspot with NodeJS: Cisco Meraki - ExCap API
Building a WiFi Hotspot with NodeJS: Cisco Meraki - ExCap APIBuilding a WiFi Hotspot with NodeJS: Cisco Meraki - ExCap API
Building a WiFi Hotspot with NodeJS: Cisco Meraki - ExCap API
 
Quick and Easy Development with Node.js and Couchbase Server
Quick and Easy Development with Node.js and Couchbase ServerQuick and Easy Development with Node.js and Couchbase Server
Quick and Easy Development with Node.js and Couchbase Server
 
using Mithril.js + postgREST to build and consume API's
using Mithril.js + postgREST to build and consume API'susing Mithril.js + postgREST to build and consume API's
using Mithril.js + postgREST to build and consume API's
 
Sebastian Schmidt, Rachel Myers - How To Go Serverless And Not Violate The GD...
Sebastian Schmidt, Rachel Myers - How To Go Serverless And Not Violate The GD...Sebastian Schmidt, Rachel Myers - How To Go Serverless And Not Violate The GD...
Sebastian Schmidt, Rachel Myers - How To Go Serverless And Not Violate The GD...
 
Tech friday 22.01.2016
Tech friday 22.01.2016Tech friday 22.01.2016
Tech friday 22.01.2016
 
Web 3.12: A browser to make us proud (GUADEC 2014)
Web 3.12: A browser to make us proud (GUADEC 2014)Web 3.12: A browser to make us proud (GUADEC 2014)
Web 3.12: A browser to make us proud (GUADEC 2014)
 
Front End Development for Back End Java Developers - Jfokus 2020
Front End Development for Back End Java Developers - Jfokus 2020Front End Development for Back End Java Developers - Jfokus 2020
Front End Development for Back End Java Developers - Jfokus 2020
 
New WSO2 Enterprise Integrator Focuses on Integration Developer Productivity
New WSO2 Enterprise Integrator Focuses on Integration Developer ProductivityNew WSO2 Enterprise Integrator Focuses on Integration Developer Productivity
New WSO2 Enterprise Integrator Focuses on Integration Developer Productivity
 
Full Stack Development With Node.Js And NoSQL (Nic Raboy & Arun Gupta)
Full Stack Development With Node.Js And NoSQL (Nic Raboy & Arun Gupta)Full Stack Development With Node.Js And NoSQL (Nic Raboy & Arun Gupta)
Full Stack Development With Node.Js And NoSQL (Nic Raboy & Arun Gupta)
 
The SharePoint & jQuery Guide - Updated 1/14/14
The SharePoint & jQuery Guide - Updated 1/14/14The SharePoint & jQuery Guide - Updated 1/14/14
The SharePoint & jQuery Guide - Updated 1/14/14
 
Now you see me... Adaptive Web Design and Development
Now you see me... Adaptive Web Design and DevelopmentNow you see me... Adaptive Web Design and Development
Now you see me... Adaptive Web Design and Development
 
Supercharge your data analytics with BigQuery
Supercharge your data analytics with BigQuerySupercharge your data analytics with BigQuery
Supercharge your data analytics with BigQuery
 
My way to clean android (EN) - Android day salamanca edition
My way to clean android (EN) - Android day salamanca editionMy way to clean android (EN) - Android day salamanca edition
My way to clean android (EN) - Android day salamanca edition
 
OSCON 2011 CouchApps
OSCON 2011 CouchAppsOSCON 2011 CouchApps
OSCON 2011 CouchApps
 
Expedite the development lifecycle with MongoDB and serverless - DEM02 - Sant...
Expedite the development lifecycle with MongoDB and serverless - DEM02 - Sant...Expedite the development lifecycle with MongoDB and serverless - DEM02 - Sant...
Expedite the development lifecycle with MongoDB and serverless - DEM02 - Sant...
 
MongoDB.local Atlanta: MongoDB Stitch Tutorial
MongoDB.local Atlanta: MongoDB Stitch TutorialMongoDB.local Atlanta: MongoDB Stitch Tutorial
MongoDB.local Atlanta: MongoDB Stitch Tutorial
 

Mehr von Boyan Mihaylov

How WebAssembly is changing the Web and what it means for Angular
How WebAssembly is changing the Web and what it means for AngularHow WebAssembly is changing the Web and what it means for Angular
How WebAssembly is changing the Web and what it means for AngularBoyan Mihaylov
 
Crafting a robust deployment pipeline in finance
Crafting a robust deployment pipeline in financeCrafting a robust deployment pipeline in finance
Crafting a robust deployment pipeline in financeBoyan Mihaylov
 
Using improv techniques for better agile teams
Using improv techniques for better agile teamsUsing improv techniques for better agile teams
Using improv techniques for better agile teamsBoyan Mihaylov
 
Web assembly brings the web to a new era
Web assembly brings the web to a new eraWeb assembly brings the web to a new era
Web assembly brings the web to a new eraBoyan Mihaylov
 
Is WebAssembly the killer of JavaScript?
Is WebAssembly the killer of JavaScript?Is WebAssembly the killer of JavaScript?
Is WebAssembly the killer of JavaScript?Boyan Mihaylov
 
Lean or agile, software architecture is fragile
Lean or agile, software architecture is fragileLean or agile, software architecture is fragile
Lean or agile, software architecture is fragileBoyan Mihaylov
 
Software architecture also needs agile
Software architecture also needs agileSoftware architecture also needs agile
Software architecture also needs agileBoyan Mihaylov
 
Agile software architecture
Agile software architectureAgile software architecture
Agile software architectureBoyan Mihaylov
 
Component-driven development with AngularJS
Component-driven development with AngularJSComponent-driven development with AngularJS
Component-driven development with AngularJSBoyan Mihaylov
 
Bringing the light to the client with KnockoutJS
Bringing the light to the client with KnockoutJSBringing the light to the client with KnockoutJS
Bringing the light to the client with KnockoutJSBoyan Mihaylov
 
Identifying methods for measuring emotions
Identifying methods for measuring emotionsIdentifying methods for measuring emotions
Identifying methods for measuring emotionsBoyan Mihaylov
 

Mehr von Boyan Mihaylov (16)

How WebAssembly is changing the Web and what it means for Angular
How WebAssembly is changing the Web and what it means for AngularHow WebAssembly is changing the Web and what it means for Angular
How WebAssembly is changing the Web and what it means for Angular
 
Crafting a robust deployment pipeline in finance
Crafting a robust deployment pipeline in financeCrafting a robust deployment pipeline in finance
Crafting a robust deployment pipeline in finance
 
Using improv techniques for better agile teams
Using improv techniques for better agile teamsUsing improv techniques for better agile teams
Using improv techniques for better agile teams
 
Web assembly brings the web to a new era
Web assembly brings the web to a new eraWeb assembly brings the web to a new era
Web assembly brings the web to a new era
 
Shifting to agile
Shifting to agileShifting to agile
Shifting to agile
 
Is WebAssembly the killer of JavaScript?
Is WebAssembly the killer of JavaScript?Is WebAssembly the killer of JavaScript?
Is WebAssembly the killer of JavaScript?
 
Lean or agile, software architecture is fragile
Lean or agile, software architecture is fragileLean or agile, software architecture is fragile
Lean or agile, software architecture is fragile
 
Software architecture also needs agile
Software architecture also needs agileSoftware architecture also needs agile
Software architecture also needs agile
 
Flux architecture
Flux architectureFlux architecture
Flux architecture
 
AngularJS 2.0
AngularJS 2.0AngularJS 2.0
AngularJS 2.0
 
To SPA or not to SPA
To SPA or not to SPATo SPA or not to SPA
To SPA or not to SPA
 
The AngularJS way
The AngularJS wayThe AngularJS way
The AngularJS way
 
Agile software architecture
Agile software architectureAgile software architecture
Agile software architecture
 
Component-driven development with AngularJS
Component-driven development with AngularJSComponent-driven development with AngularJS
Component-driven development with AngularJS
 
Bringing the light to the client with KnockoutJS
Bringing the light to the client with KnockoutJSBringing the light to the client with KnockoutJS
Bringing the light to the client with KnockoutJS
 
Identifying methods for measuring emotions
Identifying methods for measuring emotionsIdentifying methods for measuring emotions
Identifying methods for measuring emotions
 

Kürzlich hochgeladen

The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfkalichargn70th171
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...Health
 
Chinsurah Escorts ☎️8617697112 Starting From 5K to 15K High Profile Escorts ...
Chinsurah Escorts ☎️8617697112  Starting From 5K to 15K High Profile Escorts ...Chinsurah Escorts ☎️8617697112  Starting From 5K to 15K High Profile Escorts ...
Chinsurah Escorts ☎️8617697112 Starting From 5K to 15K High Profile Escorts ...Nitya salvi
 
LEVEL 5 - SESSION 1 2023 (1).pptx - PDF 123456
LEVEL 5   - SESSION 1 2023 (1).pptx - PDF 123456LEVEL 5   - SESSION 1 2023 (1).pptx - PDF 123456
LEVEL 5 - SESSION 1 2023 (1).pptx - PDF 123456KiaraTiradoMicha
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerThousandEyes
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxComplianceQuest1
 
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park %in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park masabamasaba
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsArshad QA
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVshikhaohhpro
 
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionIntroducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionOnePlan Solutions
 
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park %in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park masabamasaba
 
10 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 202410 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 2024Mind IT Systems
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfkalichargn70th171
 
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfonteinmasabamasaba
 
The Top App Development Trends Shaping the Industry in 2024-25 .pdf
The Top App Development Trends Shaping the Industry in 2024-25 .pdfThe Top App Development Trends Shaping the Industry in 2024-25 .pdf
The Top App Development Trends Shaping the Industry in 2024-25 .pdfayushiqss
 
Sector 18, Noida Call girls :8448380779 Model Escorts | 100% verified
Sector 18, Noida Call girls :8448380779 Model Escorts | 100% verifiedSector 18, Noida Call girls :8448380779 Model Escorts | 100% verified
Sector 18, Noida Call girls :8448380779 Model Escorts | 100% verifiedDelhi Call girls
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...Shane Coughlan
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension AidPhilip Schwarz
 
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech studentsHimanshiGarg82
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfonteinmasabamasaba
 

Kürzlich hochgeladen (20)

The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
Chinsurah Escorts ☎️8617697112 Starting From 5K to 15K High Profile Escorts ...
Chinsurah Escorts ☎️8617697112  Starting From 5K to 15K High Profile Escorts ...Chinsurah Escorts ☎️8617697112  Starting From 5K to 15K High Profile Escorts ...
Chinsurah Escorts ☎️8617697112 Starting From 5K to 15K High Profile Escorts ...
 
LEVEL 5 - SESSION 1 2023 (1).pptx - PDF 123456
LEVEL 5   - SESSION 1 2023 (1).pptx - PDF 123456LEVEL 5   - SESSION 1 2023 (1).pptx - PDF 123456
LEVEL 5 - SESSION 1 2023 (1).pptx - PDF 123456
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park %in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionIntroducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
 
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park %in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
 
10 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 202410 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 2024
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
 
The Top App Development Trends Shaping the Industry in 2024-25 .pdf
The Top App Development Trends Shaping the Industry in 2024-25 .pdfThe Top App Development Trends Shaping the Industry in 2024-25 .pdf
The Top App Development Trends Shaping the Industry in 2024-25 .pdf
 
Sector 18, Noida Call girls :8448380779 Model Escorts | 100% verified
Sector 18, Noida Call girls :8448380779 Model Escorts | 100% verifiedSector 18, Noida Call girls :8448380779 Model Escorts | 100% verified
Sector 18, Noida Call girls :8448380779 Model Escorts | 100% verified
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
 
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
 

Stop the internet, i want to go offline

  • 1. Stop the Internet, I want to go offline Boyan Mihaylov @bmihaylov
  • 2. @bmihaylov | BuildStuff 2016 2 We live in a connected world https://c1app.wordpress.com/2015/02/02/mobile-apps-a-simple-overview/social-media-network-connection-and-communication-in-the-global_z1j0gjo_/
  • 3. @bmihaylov | BuildStuff 2016 3 SLOWEST FASTEST Internet speed worldwide https://telegraphtravelmaps.carto.com/viz/b0a43e76-40bf-11e5-bfd4-0e6e1df11cbf/public_map
  • 4. Working while travelling @bmihaylov | BuildStuff 2016 4 https://www.wired.com/wp-content/uploads/blogs/wiredenterprise/wp-content/uploads/2013/09/docker-jungle.jpg
  • 5. Working while travelling @bmihaylov | BuildStuff 2016 5 https://www.selectlegal.co.uk/wp-content/uploads/2015/07/Man-on-train.jpg
  • 10. @bmihaylov | BuildStuff 2016 10 #1 Degrade gracefully as the network connection changes
  • 11. @bmihaylov | BuildStuff 2016 11 #2 Provide clear feedback about the my actions
  • 12. @bmihaylov | BuildStuff 2016 12 #3 Give me constant access to the content I care about
  • 13. @bmihaylov | BuildStuff 2016 13 #4 Content is mutable, no matter if I am online or offline
  • 14. @bmihaylov | BuildStuff 2016 14 #5 Remember my recent activity for me
  • 17. HTTP Headers @bmihaylov | BuildStuff 2016 17 GET /build-stuff.html HTTP/1.1 … HTTP 1/1 200 OK Cache-Control: public, max-age=86400 Expires: Tue, 22 Nov 2016, 20:00:00 GMT Last-Modified: Wed, 16 Nov 2016, 08:00:00 GMT ETag: “5485fac7-ae74” … Request Response
  • 18. Resource versioning @bmihaylov | BuildStuff 2016 18 … <link href="/css/site.css" rel="stylesheet" /> <link href="/css/baske.css?v=2" rel="stylesheet" /> … <script src="/js/moment-2.8.3.js"></script> <script src="/js/prettyCheckable.js?v=1"></script> <script src="/js/customSelect.js?v=1"></script> <script src="/js/app/basket.js?v=2"></script> <script src="/js/app/BasketController.js?v=2"></script> … <script src="/js/app-bundle.js?v=53e32af"></script> …
  • 19. Cookies @bmihaylov | BuildStuff 2016 19 GET /build-stuff.html HTTP/1.1 … HTTP 1/1 200 OK Set-Cookie: i-am-cool=true; … #1 Request #1 Response GET /build-stuff.html HTTP/1.1 Cookie: i-am-cool=true; … #2 Request
  • 20. 3rd-party plug-ins @bmihaylov | BuildStuff 2016 20
  • 22. Application cache @bmihaylov | BuildStuff 2016 22 CACHE MANIFEST # 2016-11-18 v1 CACHE: welcome.html css/style.css img/title.png NETWORK: * FALLBACK: / offline.html manifest.appcache Usage <html manifest="manifest.appcache"> … – Caching the manifest file? – Not flexible enough – Hard to debug – Deprecated + Good browser support
  • 23. Web storage @bmihaylov | BuildStuff 2016 23 localStorage.setItem("conf", "BuildStuff"); const conf = localStorage.getItem("conf"); localStorage.removeItem("conf"); localStorage.clear(); sessionStorage.setItem("mySession", "offline"); + Key-value store + Per session or permanent + Cross-browser support – Serialization / deserialization – No transactions – Limited space
  • 24. Web SQL database @bmihaylov | BuildStuff 2016 24 + SQLite in the browser + Relational DB advantages – Minimal browser support – Deprecated const db = openDatabase("mydb", "1.0", "Test DB", 50*1024*2014); db.transaction(tx => { tx.executeSql("CREATE TABLE IT NOT EXISTS Conf (id unique, name)"); tx.executeSql("INSERT INTO Conf VALUES (1, 'BuildStuff'"); });
  • 25. indexedDB @bmihaylov | BuildStuff 2016 25 + Storage of significant amounts of structured data (+ blobs) + Transactional support + (Good) browser support const dbRequest = indexedDB.open("ConfDB"); dbRequest.onupgradeneeded = () => { dbRequest.result .createObjectStore("conf", { keyPath: "id" }) .put({ id: 1, name: "BuildStuff" }); }; dbRequest.onsuccess = () => { const getRequest = dbRequest.result .objectStore("conf").get(1); getRequest.onsuccess = () => { /* getRequest.result.name */ }; }; – Complex for simple scenarios
  • 26. FileSystem API @bmihaylov | BuildStuff 2016 26 + A sandboxed file system + Store binary content – May ask for extra quota – Only supported in Chrome – Non-standard window.webkitStorageInfo .requestQuota(PERSISTENT, 1024*1024, (quota) => { window.requestFileSystem(PERSISTENT, quota, onInit, onError); }, onError); function onInit(fs) { fs.root.getFile( "log.txt", { create: true, exclusive: true }, (fileEntry) => { /* fileEntry.name */ }, onError); }
  • 27. Service Worker A script running in the background Even when the browser is closed Acts as a proxy between the browser and the network (when available) Programmatic and controllable Cache API 27@bmihaylov | BuildStuff 2016
  • 28. Service Worker lifecycle @bmihaylov | BuildStuff 2016 28 Installing Activated Idle Fetch / message Terminated Error
  • 29. Service Worker – register @bmihaylov | BuildStuff 2016 29 <script> if ("serviceWorker" in navigator) { navigator.serviceWorker.register("app-install.js") .then(function() { console.log("Service worker has been installed"); }, function(error) { console.log("Oops!", error); }); } else { console.log("No service workers support for this browser"); } </script>
  • 30. Service Worker – install @bmihaylov | BuildStuff 2016 30 const CACHE_NAME = "app.cache.v1"; this.addEventListener("install", (event) => { event.waitUntil( caches.open(CACHE_NAME).then((cache) => { return cache.addAll([ "/index.html", "/css/style.css", "/js/app.js" ]); }); ); }); … app-install.js
  • 31. Service Worker – fetch @bmihaylov | BuildStuff 2016 31 app-install.js … this.addEventListener("fetch", (event) => { event.respondWith( caches.match(event.request).then((response) => { return response || fetch(event.request); }); ); }); …
  • 32. Service Worker specifics HTTPs only Asynchronous, promise-based Not working with localStorage indexedDB only No access to DOM Isn’t tied to a particular page 32@bmihaylov | BuildStuff 2016
  • 33. Caching strategies using service workers @bmihaylov | BuildStuff 2016 33 https://jakearchibald.com/2014/offline-cookbook/
  • 34. Network only @bmihaylov | BuildStuff 2016 34 www. 1 2 3 Scenarios • Analytics requests • Non-GET requests
  • 35. Cache only @bmihaylov | BuildStuff 2016 35 www. 1 2 3 Scenarios • The static part of your app
  • 36. Cache, falling back to network @bmihaylov | BuildStuff 2016 36 www. 1 2 3 4 Scenarios • The majority of requests when building offline-first app
  • 37. Network, falling back to cache @bmihaylov | BuildStuff 2016 37 www. 1 3 2 4 Scenarios • Online users will always get the latest content • Offline users will get older content
  • 38. Cache & update @bmihaylov | BuildStuff 2016 38 www. 1 2 2 3 4 Scenarios • You don’t mind showing old content for a while
  • 39. Cache, update, refresh @bmihaylov | BuildStuff 2016 39 www. 1 2 2 3 4 4 Scenarios • Content that changes often (fx., game score, social media timeline)
  • 40. Network & cache race @bmihaylov | BuildStuff 2016 40 www. 1 2 2 3 3 Scenarios • Small “non-important” assets • Where performance is vital
  • 41. Beyond typical scenarios @bmihaylov | BuildStuff 2016 41 Network status Background sync Push notifications
  • 42. Is Service Worker ready? @bmihaylov | BuildStuff 2016 42 11 14 10 9.1 TP 10 9.3 all 4.4 4.4.4 49 50 51 52 54 53 55 56 57 52 51 49 41 42 43 53 53 IE Edge Firefox Chrome Safari Opera iOS Safari Opera Mini Android Browser Chrome for Android
  • 44. Myth #1: 4G is everywhere @bmihaylov | BuildStuff 2016 44
  • 46. Myth #3: Local data is used only for offline apps @bmihaylov | BuildStuff 2016 46
  • 47. Myth #4: Current web standards are of no use @bmihaylov | BuildStuff 2016 47
  • 48. 48 Thank you, BuildStuff! @bmihaylov | BuildStuff 2016 hey@boyan.in @bmihaylov After party