Created
July 19, 2017 20:02
-
-
Save daliborgogic/784c59af2d5acf69c1ce9cee9a28cec7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const CACHE_NAME = '$$$toolbox-cache$$$http://localhost:5000/$$$' | |
function linkIsAvailableOffline (links) { | |
links.forEach(link => { | |
const HREF = link.getAttribute('href') | |
caches.open(CACHE_NAME).then(cache => { | |
cache.match(HREF).then(response => { | |
link.setAttribute('data-offline', response ? true : false) | |
}) | |
}) | |
}) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment