diff --git a/examples/demo.js b/examples/demo.js index b84af806..02c46fef 100644 --- a/examples/demo.js +++ b/examples/demo.js @@ -200,42 +200,8 @@ window.onload = function() { } }); - if ('serviceWorker' in navigator) { - navigator.serviceWorker.register('sw.js', { scope: '/examples/' }) - .then(function(registration) { - const installingWorker = registration.installing; - installingWorker.onstatechange = () => { - console.log(installingWorker) - if (installingWorker.state === 'installed') { - location.reload(); - } - } - console.log('Registration successful, scope is:', registration.scope); - }) - .catch(function(error) { - console.log('Service worker registration failed, error:', error); - }); - } - - if ('serviceWorker' in navigator) { - caches.keys().then(function(cacheNames) { - cacheNames.forEach(function(cacheName) { - $("#clear-cache").append(" " + cacheName); - }); - }); - } - - $("#clear-cache").click(function() { - if ('serviceWorker' in navigator) { - caches.keys().then(function(cacheNames) { - cacheNames.forEach(function(cacheName) { - caches.delete(cacheName); - }); - }); - } - location.reload(); - }); - + setupCache(); + function updatePreviews(src) { $('#addStep img').remove(); diff --git a/examples/index.html b/examples/index.html index a89a09b4..844936b6 100644 --- a/examples/index.html +++ b/examples/index.html @@ -21,6 +21,7 @@ + @@ -185,12 +186,6 @@ - - - -