Sunday, May 27, 2018

Service Worker

1) is a Javascript file run in background and assists in  offline web application.
2) is a cache

<script>
if ('serviceWorker' in navigator) {
navigator.serviceWorker.register('service-worker.js')
.then(() => console.log('service worker installed'))
.catch(err => console.error('Error', err));
}
</script>

service-worker.js
var CACHE_VERSION = '0.1.1'; //Update Version

No comments:

Post a Comment