Created
June 15, 2019 20:20
-
-
Save luisenriquecorona/1236fa0acde0b45cbb7e6e71aaa8d413 to your computer and use it in GitHub Desktop.
Add a call to pirateManager.subscribeToPush in the peggy_parrot script on the check to see if notifications have been enabled
This file contains hidden or 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
document.addEventListener('DOMContentLoaded', initPage, false); | |
function initPage() { | |
if (!('Notification' in window)) { | |
// this browser does not support notifications | |
} else if (Notification.permission === 'denied') { | |
// the user denied notification permission! | |
else if (Notification.permission === 'granted') { | |
pirateManager.subscribeToPush(); | |
} ... | |
function enableNotifications() { | |
Notification.requestPermission().then((result) => { | |
pirateManager.subscribeToPush(); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment