Skip to content

Instantly share code, notes, and snippets.

@goofmint

goofmint/index.js

Created Jun 19, 2018
Embed
What would you like to do?
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
You can’t perform that action at this time.