Peter O'Shaughnessy
<link rel="manifest" href="/manifest.json">
{
"name": "Podle",
"icons": [
{
"src": "/static/icon192.png",
"sizes": "192x192",
"type": "image/png"
},
{
"src": "/static/icon512.png",
"sizes": "512x512",
"type": "image/png"
}
],
"background_color": "white",
"theme_color": "#4E3F30",
...
}
navigator.serviceWorker.register('/service-worker.js');
// Inside service-worker.js...
// Good for caching on install ("pre-cache")
self.addEventListener('install', ...);
// Good time to clear out old caches
self.addEventListener('activate', ...);
// Intercept network requests
self.addEventListener('fetch', ...);
networkFirst
(fallback to cache)cacheFirst
(fallback to network)fastest
(serve whichever comes back first)networkOnly
cacheOnly
new PaymentRequest(methodData, details)
.show()
.then(function(uiResult) {
processPayment(uiResult);
})
.catch(function(error) {
handlePaymentError(error);
});
navigator.bluetooth.requestDevice({
filters: [{
namePrefix: 'Travis'
}]
})
...