-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #77 from tonydehnke/Service-Worker-Name-Change-and…
…-Error-Reporting Update Service Worker Messages, Add error reporting message and test
- Loading branch information
Showing
3 changed files
with
14 additions
and
9 deletions.
There are no files selected for viewing
15 changes: 10 additions & 5 deletions
15
lib/generators/serviceworker/templates/serviceworker-companion.js
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,11 @@ | ||
if (navigator.serviceWorker) { | ||
navigator.serviceWorker.register('/serviceworker.js', { scope: './' }) | ||
.then(function(reg) { | ||
console.log('[Companion]', 'Service worker registered!'); | ||
}); | ||
} | ||
navigator.serviceWorker | ||
.register("/serviceworker.js", { scope: "./" }) | ||
.then(function() { | ||
console.log("[Companion]", "Rails Service worker registered!") | ||
}) | ||
.catch(function(error) { | ||
// registration failed :( | ||
console.log("[Companion]", "Rails Service worker registration failed: " + error) | ||
}) | ||
} |
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
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