-
-
Save kypflug/154e8984cfc20d8820cecaa7536154a1 to your computer and use it in GitHub Desktop.
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
function registerPush(appPubkey) { | |
if (navigator.serviceWorker) { | |
navigator.serviceWorker.register('sw.js') | |
.then(function(reg) { | |
return reg.pushManager.getSubscription().then(function(subscription) { | |
if (subscription) { | |
return subscription; | |
} | |
return registration.pushManager.subscribe({ | |
userVisibleOnly: true, applicationServerKey: appPubkey | |
}); | |
}); | |
}) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Line 10,
registration
is meant to bereg
right?