Front-End Developer @ DataXu/RailsReactor
Who is mr. ServiceWorker?
Service Worker - is a new JavaScript API, special type of
Web Worker
Web Worker - script running in background in separate
thread
To fill the gap between web and native apps in context
of offline-first approach and background operations.
What is the purpose of ServiceWorker?
It is about not treating offline like an error
What Is Offline First?
Offline as error :( :( :(☹ ☹ ☹ Offline first☺☺☺
Facebook - News Feed
Facebook - Commenting
Offline as error :( :( :( Offline first☺☺☺
● making apps available offline - install/update
● full control over app caches
● full control over network requests
● subscribing to push notifications
● background synchronization
What Service Worker Offers?
navigator.serviceWorker.getRegistration().then(function (registration) {
if (!registration) {
navigator.serviceWorker.register('/service-worker.js').then(function (registration) {
console.log('SW registration successful');
}).catch(function (err) {
console.log('SW Registration failed: ', err);
});
}
});
Registering Service Worker
1
2
3
4
5
6
7
8
9
Service Worker Registration
Browser
Network
Service Worker
importScripts(
'foo.js','bar.js'
);
Application
navigator.serviceWorker
.register('/service-worker.js')
GET /service-worker.js
200 OK /service-worker.js
GET /foo.js GET /bar.js
200 OK /foo.js 200 OK /bar.js
Service Worker Registration
● navigator.serviceWorker - a place for SW API
● SW is a separate single file
● SW supports importScripts()
● SW can’t be registered from other domain
● https is required, but localhost is white-listed
● SW doesn’t have access to main app context
● SW is cached and available offline
Service Worker Gotchas
Alright, let’s install the App!
Service Worker Install Event
Browser
Network
Service Worker
Fire ”install” event
GET /service-worker.js
200 OK /service-worker.js
Is SW
chang
ed?
Yes
http://somesite.org/
Is SW
regist
ered?
Yes
Application
Register SW
No
var staticVersion = 1;
self.addEventListener('install', function(event) {
var urlsToCache = ['/', '/app.css', '/app.js', '/vendor.js'];
event.waitUntil(
caches.open('static-cache-v' + staticVersion).then(function(cache){
return cache.addAll(urlsToCache);
});
);
});
Installing The App
1
2
3
4
5
6
7
8
9
Service Worker - Installing App
Browser
Network
Service Worker
GET urlsToCache
200 OK urlsToCache
Caches
caches.open(
'static-cache-v1'
)
.then(function(cache){
});
return cache.addAll(
urlsToCache
);
● Install - SW event that is fired when SW considered updated
● Install is fired on page load if SW content is changed
● ExtendableEvent - API allowing to pause event processing
● window.caches - place for Cache API
● All requests made from Caches and SW are processed by “classic”
browser caching mechanisms (304, ETag, cache-control, and so on)
Installing The App Gotchas
Great, let’s now serve the App!
self.addEventListener('fetch', function(event) {
event.respondWith(
caches.open('static-cache-v' + staticVersion).then(function(cache) {
return cache.match(event.request)
}).then(function(cachedResponse) {
return cachedResponse || fetch(event.request);
});
);
});
Serving Installed App
1
2
3
4
5
6
7
8
9
Service Worker - Serving Installed App
Browser
Network
Service Worker
Fetch
event.request
Caches
caches.open(
'static-cache-v1'
)
.then(function(cache){
})
return cache.match(
event.request
);
.then(function(cachedResponse) {
});
Application
Response
Use cached
response
Make network
request
Use network
response
Fire ”fetch” event
return cachedResp
|| fetch(event.request);
● FetchEvent - new type of event that allows to intercept network
requests
● Everything is a Promise when it comes to Service Worker
Serving Installed App Gotchas
And it is not only about Offline-First
It’s about speeding your app at all
Network, 2ms ping, 100Mb/s
ServiceWorker, ping and loading speed depends only on system performance
OK, and if we want to clean old stuff?
self.addEventListener('activate', function(event) {
event.waitUntil(caches.keys().then(function(cacheNames) {
return Promise.all(cacheNames.map(function(cacheName) {
if (cacheName.startsWith('static-cache-v')
&& !cacheName.endsWith(staticVersion)) {
return caches.delete(cacheName);
}
}));
}));
});
Cleaning Old App Stuff
1
2
3
4
5
6
7
8
9
10
● Activate event is fired when new SW is taking control over the
page and can be used to clean up the old version stuff
● Service Worker has two update modes - cold (default) and hot
● In cold mode SW is activated when all the pages with current active
worker are closed and new page is opened
● In hot mode activate is fired just after install is finished
Updating The App Gotchas
Cool, let’s now notify the user about
update!
function sendToClients(message) {
return self.clients.matchAll({includeUncontrolled: true})
.then(function(clients) {
clients.forEach(function(client) {
client.postMessage(message);
});
});
}
Sending Messages To Client - Service Worker Side
1
2
3
4
5
6
7
8
navigator.serviceWorker.addEventListener('message', function(event) {
// event.data is the message we received
console.log(event.data);
});
Sending Messages To Client - Application Side
event.respondWith(
fetch(event.request).then(function(response) {
return response.text().then(function(responseText) {
return new Response(
responseText.replace(/foo/g, 'bar'),
{headers: response.headers}
);
});
})
);
Modifying The Response
1
2
3
4
5
6
7
8
9
10
Fetch - new API for network requests. It is based on Promise. Say “bye-
bye” to callback based XHRs.
ExtendableEvent - API allowing to pause event processing
Response - API for working with network responses
Request - API for working with network responses
Cache - API for working with network caches
New APIs That Come With SW
● We can intercept all network requests
● We can respond to requests whatever way we want
● We can fully and flexibly control network cache
● It’s network interceptor running right in browser!
Gotchas
And it is not even everything!
Push Messages
Push Messages
Push messages is a really HUGE topic.
There is a great article on Google Dev Site
and nice simple demo:
http://bit.ly/web-push-article http://bit.ly/simple-push-demo
Background Sync
● Gives the ability to postpone tasks until user has connectivity
● Now in state of draft, available only in Chrome 49+, and a
subject to change.
Background Sync Docs
http://bit.ly/bg-sync-docs
Service Worker Browser Support
Chrome - very good (most features)
Firefox - very good (most features)
Opera - good (key features)
IE - in active development
Safari - optimistic (no support, under consideration)
Service Worker Browser Support
http://bit.ly/sw-support
Resources
● Introduction To Service Worker on HTML5 Rocks :
http://www.html5rocks.com/en/tutorials/service-worker/introduction/
● Developer Guide on Chromium site:
https://www.chromium.org/blink/serviceworker
● Service Worker Cookbook by Mozilla:
https://serviceworke.rs/
● Is Service Worker Ready? by Jake Archibald (a loooot of stuff there):
https://jakearchibald.github.io/isserviceworkerready/
Resources
● Service Worker Libraries maintained by Google:
https://developers.google.com/web/tools/service-worker-libraries/
● Instant Loading Web Apps with An Application Shell Architecture
https://developers.google.com/web/updates/2015/11/app-shell
● Sample project (played a little bit)
http://bit.ly/sw-application
Now go, grab latest Chrome or Firefox
and try it!
But remember - with big power comes
big responsibility!
Thanks for attention!
Questions?
https://facebook.com/viktor.zu
https://www.linkedin.com/in/zozulyakviktor
http://last.fm/user/zuzya

More Related Content

PDF
Redux. From twitter hype to production
PDF
«От экспериментов с инфраструктурой до внедрения в продакшен»​
PDF
PWA 與 Service Worker
PDF
Instant and offline apps with Service Worker
PDF
Service workers
PDF
Service Worker Presentation
PDF
Service Worker - Reliability bits
PDF
[JCConf 2020] 用 Kotlin 跨入 Serverless 世代
Redux. From twitter hype to production
«От экспериментов с инфраструктурой до внедрения в продакшен»​
PWA 與 Service Worker
Instant and offline apps with Service Worker
Service workers
Service Worker Presentation
Service Worker - Reliability bits
[JCConf 2020] 用 Kotlin 跨入 Serverless 世代

What's hot (20)

PDF
Svelte JS introduction
PDF
Service worker: discover the next web game changer
PDF
REST to JavaScript for Better Client-side Development
PDF
Service worker API
PDF
JS Chicago Meetup 2/23/16 - Redux & Routes
PDF
clara-rules
PDF
Autoscaling with hashi_corp_nomad
PDF
ServiceWorker: New game changer is coming!
PDF
PWA 應用 - 實現網站離線瀏覽
PPTX
Learning Svelte
PDF
Service worker - Offline Web
PPTX
Real World Lessons in Progressive Web Application & Service Worker Caching
PDF
A real-world Relay application in production - Stefano Masini - Codemotion Am...
PDF
Going fullstack React(ive) - Paulo Lopes - Codemotion Amsterdam 2017
KEY
Dancing with websocket
PDF
Service workers
PDF
Javascript Promises/Q Library
PPTX
Coolblue - Behind the Scenes Continuous Integration & Deployment
PPT
Grails Plugins
PDF
HTML5 tutorial: canvas, offfline & sockets
Svelte JS introduction
Service worker: discover the next web game changer
REST to JavaScript for Better Client-side Development
Service worker API
JS Chicago Meetup 2/23/16 - Redux & Routes
clara-rules
Autoscaling with hashi_corp_nomad
ServiceWorker: New game changer is coming!
PWA 應用 - 實現網站離線瀏覽
Learning Svelte
Service worker - Offline Web
Real World Lessons in Progressive Web Application & Service Worker Caching
A real-world Relay application in production - Stefano Masini - Codemotion Am...
Going fullstack React(ive) - Paulo Lopes - Codemotion Amsterdam 2017
Dancing with websocket
Service workers
Javascript Promises/Q Library
Coolblue - Behind the Scenes Continuous Integration & Deployment
Grails Plugins
HTML5 tutorial: canvas, offfline & sockets
Ad

Viewers also liked (20)

PPTX
JavaScript: прошлое, настоящее и будущее.
PDF
Scalable Angular 2 Application Architecture
PDF
"Пиринговый веб на JavaScript"
PPTX
Dart: питание и сила для вашего проекта
PDF
CSSO — сжимаем CSS
PPTX
Если у вас нету тестов...
PPTX
Migrate your React.js application from (m)Observable to Redux
PDF
Будь первым
PDF
В погоне за производительностью
PDF
Le service workers
PDF
В погоне за производительностью
PDF
Digital pipeline — инновации в продажах / Михаил Токовинин
PPTX
Service workers your applications never felt so good
PPT
Service Workers for Performance
PDF
Service Worker 를 이용한 
Offline Web Application 구현
PPTX
Progressive Web Apps [pt_BR]
PDF
Introduction to Progressive Web Apps, Google Developer Summit, Seoul - South ...
PDF
Introduction to Progressive web app (PWA)
PDF
Google’s PRPL Web development pattern
PDF
Elasticsearch 實戰介紹
JavaScript: прошлое, настоящее и будущее.
Scalable Angular 2 Application Architecture
"Пиринговый веб на JavaScript"
Dart: питание и сила для вашего проекта
CSSO — сжимаем CSS
Если у вас нету тестов...
Migrate your React.js application from (m)Observable to Redux
Будь первым
В погоне за производительностью
Le service workers
В погоне за производительностью
Digital pipeline — инновации в продажах / Михаил Токовинин
Service workers your applications never felt so good
Service Workers for Performance
Service Worker 를 이용한 
Offline Web Application 구현
Progressive Web Apps [pt_BR]
Introduction to Progressive Web Apps, Google Developer Summit, Seoul - South ...
Introduction to Progressive web app (PWA)
Google’s PRPL Web development pattern
Elasticsearch 實戰介紹
Ad

Similar to "Service Worker: Let Your Web App Feel Like a Native " (20)

PDF
[1C1]Service Workers
PDF
Service workers
PPT
Intro to Service Worker API and its use cases
PPTX
Service Workers: no more offline!
PPTX
Service Workers: no more offline!
PPTX
Service workers and the role they play in modern day web apps
PPTX
Introduction to Service Workers | Matteo Manchi
PDF
Into the Box 2018 Building a PWA
PPTX
Building a PWA - For Everyone Who Is Scared To
PPTX
2023_UI5con_serviceWorker.pptx
PPTX
Progressive Web Applications - The Next Gen Web Technologies
PPTX
Service workers and their role in PWAs
PDF
The web - What it has, what it lacks and where it must go
PDF
Service workers are your best friends
PPTX
GDG Ibadan #pwa
PDF
Progressive Web Apps
PPTX
Progressive Web Apps 101
PPTX
Push notification to the open web
PDF
JavaScript Service Worker Design Patterns for Better User Experience
PPTX
Progressive web applications
[1C1]Service Workers
Service workers
Intro to Service Worker API and its use cases
Service Workers: no more offline!
Service Workers: no more offline!
Service workers and the role they play in modern day web apps
Introduction to Service Workers | Matteo Manchi
Into the Box 2018 Building a PWA
Building a PWA - For Everyone Who Is Scared To
2023_UI5con_serviceWorker.pptx
Progressive Web Applications - The Next Gen Web Technologies
Service workers and their role in PWAs
The web - What it has, what it lacks and where it must go
Service workers are your best friends
GDG Ibadan #pwa
Progressive Web Apps
Progressive Web Apps 101
Push notification to the open web
JavaScript Service Worker Design Patterns for Better User Experience
Progressive web applications

More from FDConf (19)

PPT
Антон Киршанов - «Квант изменения. Реактивные реакции на React.
PDF
Игорь Еростенко - Создаем виртуальный тур
PDF
Илья Климов - Reason: маргиналы против хайпа
PDF
Максим Щепелин - Доставляя веб-контент в игру
PDF
Александр Черноокий - Как правило "победитель получает все" работает и не раб...
PDF
Михаил Волчек - Что такое Цифровая мастерская?
PDF
Radoslav Stankov - Handling GraphQL with React and Apollo
PDF
Виктор Русакович - Выборы, выборы, все фреймворки… приторны
PDF
Slobodan Stojanovic - 8 1/2 things about serverless
PPTX
Тимофей Лавренюк - Почему мне зашел PWA?
PDF
«I knew there had to be a better way to build mobile app»​
PDF
«Как перестать отлаживать асинхронные вызовы и начать жить»​
PDF
«Continuous Integration — A to Z или Непрерывная интеграция — кто всё сломал?»
PPTX
«Идеи и алгоритмы создания масштабируемой архитектуры в играх»​
PDF
«The Grail: React based Isomorph apps framework»​
PDF
«The Illusion of Time. When 60 sec is not 1 minute»​
PDF
«Книги в браузере»
PDF
«Как работают современные интерактивные карты на WebGL»​
PDF
«# Self Modifying Code»​
Антон Киршанов - «Квант изменения. Реактивные реакции на React.
Игорь Еростенко - Создаем виртуальный тур
Илья Климов - Reason: маргиналы против хайпа
Максим Щепелин - Доставляя веб-контент в игру
Александр Черноокий - Как правило "победитель получает все" работает и не раб...
Михаил Волчек - Что такое Цифровая мастерская?
Radoslav Stankov - Handling GraphQL with React and Apollo
Виктор Русакович - Выборы, выборы, все фреймворки… приторны
Slobodan Stojanovic - 8 1/2 things about serverless
Тимофей Лавренюк - Почему мне зашел PWA?
«I knew there had to be a better way to build mobile app»​
«Как перестать отлаживать асинхронные вызовы и начать жить»​
«Continuous Integration — A to Z или Непрерывная интеграция — кто всё сломал?»
«Идеи и алгоритмы создания масштабируемой архитектуры в играх»​
«The Grail: React based Isomorph apps framework»​
«The Illusion of Time. When 60 sec is not 1 minute»​
«Книги в браузере»
«Как работают современные интерактивные карты на WebGL»​
«# Self Modifying Code»​

Recently uploaded (20)

PDF
LIFE & LIVING TRILOGY - PART (3) REALITY & MYSTERY.pdf
PDF
FOISHS ANNUAL IMPLEMENTATION PLAN 2025.pdf
PDF
Journal of Dental Science - UDMY (2020).pdf
PDF
AI-driven educational solutions for real-life interventions in the Philippine...
PDF
David L Page_DCI Research Study Journey_how Methodology can inform one's prac...
PDF
Empowerment Technology for Senior High School Guide
PPTX
Introduction to pro and eukaryotes and differences.pptx
PDF
Myanmar Dental Journal, The Journal of the Myanmar Dental Association (2013).pdf
PPTX
B.Sc. DS Unit 2 Software Engineering.pptx
PDF
HVAC Specification 2024 according to central public works department
PDF
Environmental Education MCQ BD2EE - Share Source.pdf
PDF
LIFE & LIVING TRILOGY- PART (1) WHO ARE WE.pdf
PDF
FORM 1 BIOLOGY MIND MAPS and their schemes
PPTX
A powerpoint presentation on the Revised K-10 Science Shaping Paper
PPTX
What’s under the hood: Parsing standardized learning content for AI
PDF
BP 505 T. PHARMACEUTICAL JURISPRUDENCE (UNIT 1).pdf
PDF
MBA _Common_ 2nd year Syllabus _2021-22_.pdf
PDF
BP 505 T. PHARMACEUTICAL JURISPRUDENCE (UNIT 2).pdf
PDF
BP 704 T. NOVEL DRUG DELIVERY SYSTEMS (UNIT 1)
PDF
LEARNERS WITH ADDITIONAL NEEDS ProfEd Topic
LIFE & LIVING TRILOGY - PART (3) REALITY & MYSTERY.pdf
FOISHS ANNUAL IMPLEMENTATION PLAN 2025.pdf
Journal of Dental Science - UDMY (2020).pdf
AI-driven educational solutions for real-life interventions in the Philippine...
David L Page_DCI Research Study Journey_how Methodology can inform one's prac...
Empowerment Technology for Senior High School Guide
Introduction to pro and eukaryotes and differences.pptx
Myanmar Dental Journal, The Journal of the Myanmar Dental Association (2013).pdf
B.Sc. DS Unit 2 Software Engineering.pptx
HVAC Specification 2024 according to central public works department
Environmental Education MCQ BD2EE - Share Source.pdf
LIFE & LIVING TRILOGY- PART (1) WHO ARE WE.pdf
FORM 1 BIOLOGY MIND MAPS and their schemes
A powerpoint presentation on the Revised K-10 Science Shaping Paper
What’s under the hood: Parsing standardized learning content for AI
BP 505 T. PHARMACEUTICAL JURISPRUDENCE (UNIT 1).pdf
MBA _Common_ 2nd year Syllabus _2021-22_.pdf
BP 505 T. PHARMACEUTICAL JURISPRUDENCE (UNIT 2).pdf
BP 704 T. NOVEL DRUG DELIVERY SYSTEMS (UNIT 1)
LEARNERS WITH ADDITIONAL NEEDS ProfEd Topic

"Service Worker: Let Your Web App Feel Like a Native "

  • 1. Front-End Developer @ DataXu/RailsReactor
  • 2. Who is mr. ServiceWorker? Service Worker - is a new JavaScript API, special type of Web Worker Web Worker - script running in background in separate thread
  • 3. To fill the gap between web and native apps in context of offline-first approach and background operations. What is the purpose of ServiceWorker?
  • 4. It is about not treating offline like an error What Is Offline First?
  • 5. Offline as error :( :( :(☹ ☹ ☹ Offline first☺☺☺ Facebook - News Feed
  • 6. Facebook - Commenting Offline as error :( :( :( Offline first☺☺☺
  • 7. ● making apps available offline - install/update ● full control over app caches ● full control over network requests ● subscribing to push notifications ● background synchronization What Service Worker Offers?
  • 8. navigator.serviceWorker.getRegistration().then(function (registration) { if (!registration) { navigator.serviceWorker.register('/service-worker.js').then(function (registration) { console.log('SW registration successful'); }).catch(function (err) { console.log('SW Registration failed: ', err); }); } }); Registering Service Worker 1 2 3 4 5 6 7 8 9
  • 9. Service Worker Registration Browser Network Service Worker importScripts( 'foo.js','bar.js' ); Application navigator.serviceWorker .register('/service-worker.js') GET /service-worker.js 200 OK /service-worker.js GET /foo.js GET /bar.js 200 OK /foo.js 200 OK /bar.js Service Worker Registration
  • 10. ● navigator.serviceWorker - a place for SW API ● SW is a separate single file ● SW supports importScripts() ● SW can’t be registered from other domain ● https is required, but localhost is white-listed ● SW doesn’t have access to main app context ● SW is cached and available offline Service Worker Gotchas
  • 12. Service Worker Install Event Browser Network Service Worker Fire ”install” event GET /service-worker.js 200 OK /service-worker.js Is SW chang ed? Yes http://somesite.org/ Is SW regist ered? Yes Application Register SW No
  • 13. var staticVersion = 1; self.addEventListener('install', function(event) { var urlsToCache = ['/', '/app.css', '/app.js', '/vendor.js']; event.waitUntil( caches.open('static-cache-v' + staticVersion).then(function(cache){ return cache.addAll(urlsToCache); }); ); }); Installing The App 1 2 3 4 5 6 7 8 9
  • 14. Service Worker - Installing App Browser Network Service Worker GET urlsToCache 200 OK urlsToCache Caches caches.open( 'static-cache-v1' ) .then(function(cache){ }); return cache.addAll( urlsToCache );
  • 15. ● Install - SW event that is fired when SW considered updated ● Install is fired on page load if SW content is changed ● ExtendableEvent - API allowing to pause event processing ● window.caches - place for Cache API ● All requests made from Caches and SW are processed by “classic” browser caching mechanisms (304, ETag, cache-control, and so on) Installing The App Gotchas
  • 16. Great, let’s now serve the App!
  • 17. self.addEventListener('fetch', function(event) { event.respondWith( caches.open('static-cache-v' + staticVersion).then(function(cache) { return cache.match(event.request) }).then(function(cachedResponse) { return cachedResponse || fetch(event.request); }); ); }); Serving Installed App 1 2 3 4 5 6 7 8 9
  • 18. Service Worker - Serving Installed App Browser Network Service Worker Fetch event.request Caches caches.open( 'static-cache-v1' ) .then(function(cache){ }) return cache.match( event.request ); .then(function(cachedResponse) { }); Application Response Use cached response Make network request Use network response Fire ”fetch” event return cachedResp || fetch(event.request);
  • 19. ● FetchEvent - new type of event that allows to intercept network requests ● Everything is a Promise when it comes to Service Worker Serving Installed App Gotchas
  • 20. And it is not only about Offline-First
  • 21. It’s about speeding your app at all Network, 2ms ping, 100Mb/s ServiceWorker, ping and loading speed depends only on system performance
  • 22. OK, and if we want to clean old stuff?
  • 23. self.addEventListener('activate', function(event) { event.waitUntil(caches.keys().then(function(cacheNames) { return Promise.all(cacheNames.map(function(cacheName) { if (cacheName.startsWith('static-cache-v') && !cacheName.endsWith(staticVersion)) { return caches.delete(cacheName); } })); })); }); Cleaning Old App Stuff 1 2 3 4 5 6 7 8 9 10
  • 24. ● Activate event is fired when new SW is taking control over the page and can be used to clean up the old version stuff ● Service Worker has two update modes - cold (default) and hot ● In cold mode SW is activated when all the pages with current active worker are closed and new page is opened ● In hot mode activate is fired just after install is finished Updating The App Gotchas
  • 25. Cool, let’s now notify the user about update!
  • 26. function sendToClients(message) { return self.clients.matchAll({includeUncontrolled: true}) .then(function(clients) { clients.forEach(function(client) { client.postMessage(message); }); }); } Sending Messages To Client - Service Worker Side 1 2 3 4 5 6 7 8
  • 27. navigator.serviceWorker.addEventListener('message', function(event) { // event.data is the message we received console.log(event.data); }); Sending Messages To Client - Application Side
  • 28. event.respondWith( fetch(event.request).then(function(response) { return response.text().then(function(responseText) { return new Response( responseText.replace(/foo/g, 'bar'), {headers: response.headers} ); }); }) ); Modifying The Response 1 2 3 4 5 6 7 8 9 10
  • 29. Fetch - new API for network requests. It is based on Promise. Say “bye- bye” to callback based XHRs. ExtendableEvent - API allowing to pause event processing Response - API for working with network responses Request - API for working with network responses Cache - API for working with network caches New APIs That Come With SW
  • 30. ● We can intercept all network requests ● We can respond to requests whatever way we want ● We can fully and flexibly control network cache ● It’s network interceptor running right in browser! Gotchas
  • 31. And it is not even everything!
  • 33. Push Messages Push messages is a really HUGE topic. There is a great article on Google Dev Site and nice simple demo: http://bit.ly/web-push-article http://bit.ly/simple-push-demo
  • 34. Background Sync ● Gives the ability to postpone tasks until user has connectivity ● Now in state of draft, available only in Chrome 49+, and a subject to change.
  • 36. Service Worker Browser Support Chrome - very good (most features) Firefox - very good (most features) Opera - good (key features) IE - in active development Safari - optimistic (no support, under consideration)
  • 37. Service Worker Browser Support http://bit.ly/sw-support
  • 38. Resources ● Introduction To Service Worker on HTML5 Rocks : http://www.html5rocks.com/en/tutorials/service-worker/introduction/ ● Developer Guide on Chromium site: https://www.chromium.org/blink/serviceworker ● Service Worker Cookbook by Mozilla: https://serviceworke.rs/ ● Is Service Worker Ready? by Jake Archibald (a loooot of stuff there): https://jakearchibald.github.io/isserviceworkerready/
  • 39. Resources ● Service Worker Libraries maintained by Google: https://developers.google.com/web/tools/service-worker-libraries/ ● Instant Loading Web Apps with An Application Shell Architecture https://developers.google.com/web/updates/2015/11/app-shell ● Sample project (played a little bit) http://bit.ly/sw-application
  • 40. Now go, grab latest Chrome or Firefox and try it!
  • 41. But remember - with big power comes big responsibility!