1// Lorsque l'on reçoit un event push, on affiche 2// une notification 3self.addEventListener("push", (event) => { 4 if (!(self.Notification && self.Notification.permission === "granted")) { 5 return 6 } 7 8 const sendNotification = (message) => { 9 const title = message.titre 10 const url = message.url 11 const body = message.contenu 12 const image = message.image 13 const icon = message.icon 14 15 return self.registration.showNotification(title, { 16 body: body, 17 image: image, 18 icon: icon, 19 data: { 20 url: url, 21 }, 22 requireInteraction: true, 23 }) 24 } 25 26 if (event.data) { 27 // On va recevoir du json depuis Drupal 28 const message = event.data.json() 29 event.waitUntil(sendNotification(message)) 30 } 31}) 32 33// Lorsque l'utilisateur clique sur la notification 34// on le redirige vers l'url renseignée 35self.addEventListener("notificationclick", (event) => { 36 const data = event.notification.data 37 event.notification.close() 38 self.clients.openWindow(data.url) 39})
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.