Skip to content

Instantly share code, notes, and snippets.

@luisenriquecorona
Created June 15, 2019 20:20
Show Gist options
  • Save luisenriquecorona/1236fa0acde0b45cbb7e6e71aaa8d413 to your computer and use it in GitHub Desktop.
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
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