Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
dmd3440-chat-app/register-sw.js
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
12 lines (12 sloc)
551 Bytes
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
// Register a service worker, this one located in serviceworker.js | |
// A service worker is a piece of code the browser runs behind the scenes. | |
if ('serviceWorker' in navigator) { | |
console.log('CLIENT: service worker registration in progress.'); | |
navigator.serviceWorker.register('sw.js').then(function() { | |
console.log('CLIENT: service worker registration complete.'); | |
}, function() { | |
console.log('CLIENT: service worker registration failure.'); | |
}); | |
} else { | |
console.log('CLIENT: service workers are not supported.'); | |
} |