際際滷
Submit Search
Progressive Mobile Web Apps
?
7 likes
?
4,043 views
dynamis
Follow
ng-japan 2016 で聞喘したスライド http://ngjapan.org/
Read less
Read more
1 of 60
Download now
Download to read offline
More Related Content
Progressive Mobile Web Apps
10.
? ?
11.
?
12.
?
13.
? ? ?
15.
? ? ?
35.
?
37.
if ('serviceWorker' in
navigator) { navigator.serviceWorker.register('sw.js') .then(function(registration) { console.log('Service Worker 鞠hできた'); }); } if ('serviceWorker' in navigator) { var options = {scope: 'sw/'}; navigator.serviceWorker.register('sw.js', options) .then(function(registration) { console.log('sw/ 塘和の URL に鞠hできた'); }); }
38.
var CACHE_NAME =
'my-site-cache-v1'; var urlsToCache = [ '/', '/style.css', '/script.js']; self.addEventListener('install', function(event) { // Perform install steps event.waitUntil( caches.open(CACHE_NAME) .then(function(cache) { console.log('Opened cache'); return cache.addAll(urlsToCache); }) ); });
41.
?
42.
var urlsToCache =
[ '/', '/style.css', '/script.js'];? self.addEventListener('fetch', function(event) { event.respondWith( caches.match(event.request) .then(function(response) { // Cache hit - return response if (response) { return response; } return fetch(event.request); } ) ); });
44.
? ? ? ?
45.
? ? ?
48.
{ "short_name": "れっさ`もふもふ", "name": "レッサ`パンダのもふもふ殆灰▲廛蝪", "icons":
[ { "src": "launcher-icon-3x.png", "sizes": "144x144", "type": "image/png" } ], "start_url": "index.html", "display": "standalone" }
49.
?
52.
async function registerForPush()
{ // Service Worker を鞠h、 let registration = await navigator.serviceWorker.register('sw.js') // プッシュ宥岑をigみか_J、 let subscription = await registration.pushManager.getSubscription() // 隆iであればiリクエスト if (!subscription) { subscription = await registration.pushManager.subscribe() } // サ`バ箸砲瞋h await fetch('/save-push-endpoint', { method: 'post', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(subscription) }) // あとは駅勣rに subscription.endpoint に POST でプッシュ宥岑 }
56.
?
58.
HTML5 CSS3 WebGL ECMA6 DOM4 HTTP/2 IndexedDB Service? Workers WAI-ARIA WebRTC Presentation TCP asm.js SVG Audio Push Manifest WebVR DNT
Download now