Andrzej Mazur • @end3r • Enclave Games
GDG DevFest 2018, Warsaw, December 1st 2018
Native-like experience using modern web APIs
{
"name": "HexRoulette",
"short_name": "HexRoulette",
"description": "Digital add-on to the physical board game...",
"icons": [
{
"src": "img/icons/icon-32.png",
"sizes": "32x32",
"type": "image/png"
},
// ...
],
"start_url": "/index.html",
"display": "fullscreen",
"theme_color": "#BD6B19",
"background_color": "#161516"
}
if('serviceWorker' in navigator) {
navigator.serviceWorker.register('/roulette/sw.js');
};
self.addEventListener('install', function(e) {
e.waitUntil(
caches.open(cacheName).then(function(cache) {
return cache.addAll(contentToCache);
})
);
});
self.addEventListener('fetch', function(e) {
e.respondWith(
caches.match(e.request).then(function(r) {
return r || fetch(e.request).then(function(response) {
return caches.open(cacheName).then(function(cache) {
cache.put(e.request, response.clone());
return response;
});
});
})
);
});
Build the future of the Web (and some games)!
end3r.com/slides/devfest18-pwa