Skip to content

Instantly share code, notes, and snippets.

@jasminabasurita
Created January 29, 2018 03:27
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 jasminabasurita/4eb79155958058397d5c77d0f6f0264f to your computer and use it in GitHub Desktop.
Save jasminabasurita/4eb79155958058397d5c77d0f6f0264f to your computer and use it in GitHub Desktop.
self.addEventListener("push", event => {
const data = event.data.json()
const { title } = data
const body = {
body: data.body,
icon: data.icon
}
event.waitUntil(self.registration.showNotification(title, body))
})
@bidorboocrew
Copy link

Hey Jasmina ! I liked your article about using webpush notifications I am just wondering

Where would I add this ?
"self" refers to what in this context

@dnsnx
Copy link

dnsnx commented Feb 11, 2020

@bidorboocrew This is exactly the question I have, too. Did you find out where to add this?

@papapmarumo
Copy link

you add it to your service worker file in your react code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment