Reference
Checking for updates
if (window.applicationCache) {
// "Naturally" reload when an update is available
var cache = window.applicationCache
var reload = false
cache.addEventListener('updateready', () => {
if (cache.status === cache.UPDATEREADY) {
cache.swapCache()
reload = true
}
}, false)
setInterval(() => {
try {
// Nothing to update on first load; browsers error
cache.update()
} catch (e) { }
}, 1000 * 60 * 60) // Every hour
}
window.applicationCache was removed from browsers; use Service Workers
instead.
See: Service Worker API (developer.mozilla.org)
0 Comments for this cheatsheet. Write yours!