{
"short_name": "BBC News",
"name": "BBC News",
"icons": [
{
"src": "launcher-icon-2x.png",
"sizes": "96x96",
"type": "image/png"
},
{
"src": "launcher-icon-3x.png",
"sizes": "144x144",
"type": "image/png"
}
],
"start_url": "/",
"display": "standalone",
"orientation": "landscape"
}
<link rel="manifest" href="/manifest.json">
this.addEventListener('install', event => {
event.waitUntil(
caches.open('v1').then(cache => {
return cache.addAll([
'/news/blogs-news-from-elsewhere-36586189',
'/news/blogs-news-from-elsewhere-36561197',
'/news/world-us-canada-36541261',
'/styles/core.css',
'/styles/enhanced.css',
'/js/main.js'
])
})
)
})
this.addEventListener('fetch', event => {
event.respondWith(
caches.match(event.request)
.then(response => response || fetch(event.request))
)
})
this.addEventListener('push', event => {
console.log('Look mum, push notifications!', event)
event.waitUntil(
this.registration.showNotification('BREAKING NEWS: Sheep', {
body: 'BBC News is receiving reports of sheep.',
icon: '/images/notifications/emergency-sheep.png',
tag: 'you-can-tag-notifications'
})
)
})