Skip to content

Instantly share code, notes, and snippets.

@cionman
Last active December 4, 2017 08:54
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 cionman/44a2f1560cf916f4129d777f53f896b7 to your computer and use it in GitHub Desktop.
Save cionman/44a2f1560cf916f4129d777f53f896b7 to your computer and use it in GitHub Desktop.
서비스워커 등록
<script>
/**
* Dom 로딩 후 동작
*/
document.addEventListener('DOMContentLoaded', function() {
//...생략
if(navigator.serviceWorker){
navigator.serviceWorker.register('/firebase-messaging-sw.js')
.then(function(reg){console.log('서비스워커 등록성공 :', reg)})
.catch(function(error){console.log('서비스워커 등록실패 :', error)});
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment