Submit Search
Upload
Introduction to Service Worker
•
1 like
•
1,384 views
Shogo Sensui
Follow
2015/2/21に開催されたFrontrend Conferenceの「Introduction to Service Worker」のセッションの資料です。
Read less
Read more
Technology
Report
Share
Report
Share
1 of 85
Download now
Download to read offline
Recommended
Simular un next del recordset en php de forma rudimentaria
Simular un next del recordset en php de forma rudimentaria
jbersosa
Sumahexavector
Sumahexavector
jbersosa
Working With Ajax Frameworks
Working With Ajax Frameworks
Jonathan Snook
Local storages
Local storages
Дмитрий Скинтиян
Sumahex
Sumahex
jbersosa
Javascript and jQuery for Mobile
Javascript and jQuery for Mobile
Ivano Malavolta
PHPのすべらない話#3
PHPのすべらない話#3
Moriyoshi Koizumi
jQuery for designers
jQuery for designers
Johan Ronsse
Recommended
Simular un next del recordset en php de forma rudimentaria
Simular un next del recordset en php de forma rudimentaria
jbersosa
Sumahexavector
Sumahexavector
jbersosa
Working With Ajax Frameworks
Working With Ajax Frameworks
Jonathan Snook
Local storages
Local storages
Дмитрий Скинтиян
Sumahex
Sumahex
jbersosa
Javascript and jQuery for Mobile
Javascript and jQuery for Mobile
Ivano Malavolta
PHPのすべらない話#3
PHPのすべらない話#3
Moriyoshi Koizumi
jQuery for designers
jQuery for designers
Johan Ronsse
Clase 10 electiva profesional 3 aws rds php y mysql
Clase 10 electiva profesional 3 aws rds php y mysql
Richard Eliseo Mendoza Gafaro
Jsoon
Jsoon
iqbalfatoni01
Java script.trend(spec)
Java script.trend(spec)
dynamis
Sis quiz
Sis quiz
Clesio Veloso
Symfony2でMongoDBと仲良くする方法
Symfony2でMongoDBと仲良くする方法
Koji Iwazaki
Dennis zapana perez
Dennis zapana perez
dennis_elvis
Php codigos interfaces fredy guzman cusihunca
Php codigos interfaces fredy guzman cusihunca
Tigger_Fred
Sumahexavector
Sumahexavector
jbersosa
SmartCSS
SmartCSS
Ryo Miyake
Add tag shortcode
Add tag shortcode
Peter Baylies
Modern Mobile Web Apps
Modern Mobile Web Apps
dynamis
Formulario
Formulario
tukisele
Miniray.php
Miniray.php
maeeeng69
Wek14 mysql 2
Wek14 mysql 2
Rani Sarungallo Rombe
Func
Func
Hvqr
jQuery - Javascript para quem não sabe Javascript
jQuery - Javascript para quem não sabe Javascript
Nando Vieira
Php & mysql
Php & mysql
ola98z
Documentacion edderson callpa_ortiz
Documentacion edderson callpa_ortiz
Edderson J. Ortiz
Index2
Index2
grateful7
Phpex3
Phpex3
augustodebian
Web若手エンジニアの会(仮)
Web若手エンジニアの会(仮)
Naoyuki Kataoka
レンタルサーバで今すぐ始めるWEB開発
レンタルサーバで今すぐ始めるWEB開発
Naoyuki Kataoka
More Related Content
What's hot
Clase 10 electiva profesional 3 aws rds php y mysql
Clase 10 electiva profesional 3 aws rds php y mysql
Richard Eliseo Mendoza Gafaro
Jsoon
Jsoon
iqbalfatoni01
Java script.trend(spec)
Java script.trend(spec)
dynamis
Sis quiz
Sis quiz
Clesio Veloso
Symfony2でMongoDBと仲良くする方法
Symfony2でMongoDBと仲良くする方法
Koji Iwazaki
Dennis zapana perez
Dennis zapana perez
dennis_elvis
Php codigos interfaces fredy guzman cusihunca
Php codigos interfaces fredy guzman cusihunca
Tigger_Fred
Sumahexavector
Sumahexavector
jbersosa
SmartCSS
SmartCSS
Ryo Miyake
Add tag shortcode
Add tag shortcode
Peter Baylies
Modern Mobile Web Apps
Modern Mobile Web Apps
dynamis
Formulario
Formulario
tukisele
Miniray.php
Miniray.php
maeeeng69
Wek14 mysql 2
Wek14 mysql 2
Rani Sarungallo Rombe
Func
Func
Hvqr
jQuery - Javascript para quem não sabe Javascript
jQuery - Javascript para quem não sabe Javascript
Nando Vieira
Php & mysql
Php & mysql
ola98z
Documentacion edderson callpa_ortiz
Documentacion edderson callpa_ortiz
Edderson J. Ortiz
Index2
Index2
grateful7
Phpex3
Phpex3
augustodebian
What's hot
(20)
Clase 10 electiva profesional 3 aws rds php y mysql
Clase 10 electiva profesional 3 aws rds php y mysql
Jsoon
Jsoon
Java script.trend(spec)
Java script.trend(spec)
Sis quiz
Sis quiz
Symfony2でMongoDBと仲良くする方法
Symfony2でMongoDBと仲良くする方法
Dennis zapana perez
Dennis zapana perez
Php codigos interfaces fredy guzman cusihunca
Php codigos interfaces fredy guzman cusihunca
Sumahexavector
Sumahexavector
SmartCSS
SmartCSS
Add tag shortcode
Add tag shortcode
Modern Mobile Web Apps
Modern Mobile Web Apps
Formulario
Formulario
Miniray.php
Miniray.php
Wek14 mysql 2
Wek14 mysql 2
Func
Func
jQuery - Javascript para quem não sabe Javascript
jQuery - Javascript para quem não sabe Javascript
Php & mysql
Php & mysql
Documentacion edderson callpa_ortiz
Documentacion edderson callpa_ortiz
Index2
Index2
Phpex3
Phpex3
Viewers also liked
Web若手エンジニアの会(仮)
Web若手エンジニアの会(仮)
Naoyuki Kataoka
レンタルサーバで今すぐ始めるWEB開発
レンタルサーバで今すぐ始めるWEB開発
Naoyuki Kataoka
Objective-CのBlocksの循環参照に関する僕なりのベストプラクティス
Objective-CのBlocksの循環参照に関する僕なりのベストプラクティス
Naoyuki Kataoka
Php入門
Php入門
dcubeio
GoogleTagManagerを使ってタグ運用を楽にしませんか?
GoogleTagManagerを使ってタグ運用を楽にしませんか?
dcubeio
[D3]サーバーレスでサービスを作ってみた話
[D3]サーバーレスでサービスを作ってみた話
dcubeio
React NativeでTwitterクライアントを作ってみよう
React NativeでTwitterクライアントを作ってみよう
dcubeio
シロク流事業の立ち上げ方の成功と失敗
シロク流事業の立ち上げ方の成功と失敗
Naoyuki Kataoka
Web Components 2016 & Polymer v2
Web Components 2016 & Polymer v2
Shogo Sensui
覚えて帰ろうJavaデザインパターン
覚えて帰ろうJavaデザインパターン
dcubeio
Jenkinsを使った初めての継続的インテグレーション
Jenkinsを使った初めての継続的インテグレーション
dcubeio
【D3 公開用】ドメイン駆動設計とscala 〜既存プロジェクトへの適用〜
【D3 公開用】ドメイン駆動設計とscala 〜既存プロジェクトへの適用〜
dcubeio
Introduction to Resource Hints
Introduction to Resource Hints
Shogo Sensui
成長する組織を支えるシロクの自動化
成長する組織を支えるシロクの自動化
Naoyuki Kataoka
初心者のためのWeb標準技術
初心者のためのWeb標準技術
Shogo Sensui
Effective ES6
Effective ES6
Teppei Sato
React を導入したフロントエンド開発
React を導入したフロントエンド開発
daisuke-a-matsui
Flux react現状確認会
Flux react現状確認会
VOYAGE GROUP
なぜ人は必死でjQueryを捨てようとしているのか
なぜ人は必死でjQueryを捨てようとしているのか
Yoichi Toyota
Web フロントエンドの変遷とこれから
Web フロントエンドの変遷とこれから
Shogo Sensui
Viewers also liked
(20)
Web若手エンジニアの会(仮)
Web若手エンジニアの会(仮)
レンタルサーバで今すぐ始めるWEB開発
レンタルサーバで今すぐ始めるWEB開発
Objective-CのBlocksの循環参照に関する僕なりのベストプラクティス
Objective-CのBlocksの循環参照に関する僕なりのベストプラクティス
Php入門
Php入門
GoogleTagManagerを使ってタグ運用を楽にしませんか?
GoogleTagManagerを使ってタグ運用を楽にしませんか?
[D3]サーバーレスでサービスを作ってみた話
[D3]サーバーレスでサービスを作ってみた話
React NativeでTwitterクライアントを作ってみよう
React NativeでTwitterクライアントを作ってみよう
シロク流事業の立ち上げ方の成功と失敗
シロク流事業の立ち上げ方の成功と失敗
Web Components 2016 & Polymer v2
Web Components 2016 & Polymer v2
覚えて帰ろうJavaデザインパターン
覚えて帰ろうJavaデザインパターン
Jenkinsを使った初めての継続的インテグレーション
Jenkinsを使った初めての継続的インテグレーション
【D3 公開用】ドメイン駆動設計とscala 〜既存プロジェクトへの適用〜
【D3 公開用】ドメイン駆動設計とscala 〜既存プロジェクトへの適用〜
Introduction to Resource Hints
Introduction to Resource Hints
成長する組織を支えるシロクの自動化
成長する組織を支えるシロクの自動化
初心者のためのWeb標準技術
初心者のためのWeb標準技術
Effective ES6
Effective ES6
React を導入したフロントエンド開発
React を導入したフロントエンド開発
Flux react現状確認会
Flux react現状確認会
なぜ人は必死でjQueryを捨てようとしているのか
なぜ人は必死でjQueryを捨てようとしているのか
Web フロントエンドの変遷とこれから
Web フロントエンドの変遷とこれから
More from Shogo Sensui
Web Standards Interop 2022
Web Standards Interop 2022
Shogo Sensui
Introduction to Performance APIs
Introduction to Performance APIs
Shogo Sensui
Web Standards 2018
Web Standards 2018
Shogo Sensui
The State of Web Components
The State of Web Components
Shogo Sensui
Component of Web Frontend
Component of Web Frontend
Shogo Sensui
これからのJavaScriptの話
これからのJavaScriptの話
Shogo Sensui
We should optimize images
We should optimize images
Shogo Sensui
Web Components changes Web Development
Web Components changes Web Development
Shogo Sensui
Re-think about Web Performance
Re-think about Web Performance
Shogo Sensui
Browser Computing Structure
Browser Computing Structure
Shogo Sensui
Brush up your Coding! 2013 winter
Brush up your Coding! 2013 winter
Shogo Sensui
Brush up your Coding!
Brush up your Coding!
Shogo Sensui
Functional JavaScript with Lo-Dash.js
Functional JavaScript with Lo-Dash.js
Shogo Sensui
More from Shogo Sensui
(13)
Web Standards Interop 2022
Web Standards Interop 2022
Introduction to Performance APIs
Introduction to Performance APIs
Web Standards 2018
Web Standards 2018
The State of Web Components
The State of Web Components
Component of Web Frontend
Component of Web Frontend
これからのJavaScriptの話
これからのJavaScriptの話
We should optimize images
We should optimize images
Web Components changes Web Development
Web Components changes Web Development
Re-think about Web Performance
Re-think about Web Performance
Browser Computing Structure
Browser Computing Structure
Brush up your Coding! 2013 winter
Brush up your Coding! 2013 winter
Brush up your Coding!
Brush up your Coding!
Functional JavaScript with Lo-Dash.js
Functional JavaScript with Lo-Dash.js
Introduction to Service Worker
1.
2.
!
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
"# $
13.
%&
14.
15.
16.
17.
18.
19.
20.
オフラインファーストとは
21.
22.
23.
24.
25.
26.
27.
28.
29.
30.
31.
32.
33.
' ( )
* + # , & && - - & &&
34.
35.
var value =
localStorage['key']; var json = JSON.parse(value); localStorage['key'] = JSON.stringify(json);
36.
' ( )
* + # , - -- -- - - -
37.
38.
var db; var objectStore; var
req = window.indexedDB.open('dbname', 3); req.onsuccess = function(event) { db = event.target.result; }; req.onupgradeneeded = function(event) { db = event.target.result; objectStore = db.createObjectStore('name', { keyPath: 'key' }); };
39.
' ( )
* + # , - -- -- - - -
40.
<html manifest=app.mf>
41.
CACHE MANIFEST # Resource
to cache CACHE: index.html stylesheet.css image.png script.js # Resource to bypass NETWORK: login.php /api/data # Fallback URLs FALLBACK: / /offline.html
42.
43.
44.
45.
if (navigator.onLine) { $.ajax({ url:
'/api/data', method: 'get' }).done(function (data) { render(data); }); } else { var cacheData = localStorage.getItem('key'); render(JSON.parse(cacheData)); }
46.
47.
48.
49.
50.
51.
52.
53.
var sw =
navigator.serviceWorker; sw.register('sw.js').then(function (res) { console.log('sw.js is installed!'); }, function (error) { console.log('sw.js is not installed...'); });
54.
55.
56.
57.
self.addEventListener('fetch', function (e)
{ console.log('Request in Browser'); e.respondWith( new Response('Not Found', { status: 404 }) ); });
58.
59.
60.
61.
fetch('/url/json').then(function (res) { return
res.json(); }).then(function (json) { console.log(json); });
62.
63.
64.
65.
66.
caches.open('cache-key').then(function(cache) { return cache.addAll([ 'js/app.js', 'css/app.css', 'img/image.png' ]); }); caches.match(e.request).then(function
(res) { return res; });
67.
68.
69.
70.
var sw =
navigator.serviceWorker; sw.ready.then(function(reg) { reg.syncManager.register({ id: "periodicSync", minDelay: 60 * 60 * 1000, minPeriod: 12 * 60 * 60 * 1000, allowOnBattery: true idleRequired: false }).then(function() { // Success }); });
71.
72.
73.
var sw =
navigator.serviceWorker; sw.ready.then(function(reg) { reg.pushManager.subscribe().then( function(subscription) { // Success console.log(subscription.subscriptionId); console.log(subscription.endpoint); } }); });
74.
75.
76.
77.
' ( )
* + # , - - - && & -
78.
79.
80.
81.
82.
e.respondWith( caches.open(CACHE_KEY).then(function (cache) { return
cache.match(e.request) .then(function (response) { if (response) { return response; } else { return fetch(e.request.clone()) .then(function (res) { cache.put(e.request, res.clone()); return res; }); } }); }) );
83.
84.
85.
. ! /
Download now