Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@daliborgogic
Created July 19, 2017 20:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save daliborgogic/784c59af2d5acf69c1ce9cee9a28cec7 to your computer and use it in GitHub Desktop.
Save daliborgogic/784c59af2d5acf69c1ce9cee9a28cec7 to your computer and use it in GitHub Desktop.
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