Skip to content

Instantly share code, notes, and snippets.

@kypflug

kypflug/sw-10.js Secret

Created Dec 15, 2017
Embed
What would you like to do?
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
});
});
})
}
}
@Silic0nS0ldier

This comment has been minimized.

Copy link

@Silic0nS0ldier Silic0nS0ldier commented Jan 12, 2018

Line 10, registration is meant to be reg right?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.