Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@goofmint
Created July 2, 2018 09:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save goofmint/468a866b66dae46a43e0ea8ee950517e to your computer and use it in GitHub Desktop.
Save goofmint/468a866b66dae46a43e0ea8ee950517e to your computer and use it in GitHub Desktop.
const SubscribePushNotification = () => {
navigator.serviceWorker.ready
.then(serviceWorkerRegistration => {
const subscribe = serviceWorkerRegistration
.pushManager
.subscribe({
userVisibleOnly: true
});
return subscribe;
})
.then(subscription => {
// 購読開始
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment