Skip to content

Instantly share code, notes, and snippets.

@goofmint
Created August 14, 2018 14:17
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 goofmint/1bc3bbfbdbf6d226ed21853d4a4ffc89 to your computer and use it in GitHub Desktop.
Save goofmint/1bc3bbfbdbf6d226ed21853d4a4ffc89 to your computer and use it in GitHub Desktop.
if ('serviceWorker' in navigator) {
navigator.serviceWorker
.register('/serviceworker.js')
.then(registration => {
// 登録成功
registration.onupdatefound = function() {
console.log('アップデートがあります!');
registration.update();
}
})
.catch(err => {
// 登録失敗
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment