Created
June 19, 2018 09:11
-
-
Save goofmint/dca3c60abc95d829888557a037b633cf to your computer and use it in GitHub Desktop.
This file contains 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
if ('serviceWorker' in navigator) { | |
navigator.serviceWorker | |
.register('./sw.js', { | |
scope: './' | |
}) | |
.then((reg) => { | |
if(reg.installing) { | |
console.log('Service Worker をインストール中です'); | |
} else if(reg.waiting) { | |
console.log('Service Worker をインストールしました'); | |
} else if(reg.active) { | |
console.log('Service Worker は有効です'); | |
} | |
}) | |
.catch((error) => { | |
// registration failed | |
console.log('登録失敗:', error); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment