diff options
Diffstat (limited to 'files/fr/web/api/pushevent')
-rw-r--r-- | files/fr/web/api/pushevent/index.md | 46 |
1 files changed, 23 insertions, 23 deletions
diff --git a/files/fr/web/api/pushevent/index.md b/files/fr/web/api/pushevent/index.md index a1364ab73c..7c190dfbd2 100644 --- a/files/fr/web/api/pushevent/index.md +++ b/files/fr/web/api/pushevent/index.md @@ -39,29 +39,29 @@ L'exemple suivant prends les données du `PushEvent` et les affiche sur tous les ```js self.addEventListener('push', function(event) { - if (!(self.Notification && self.notification.permission === 'granted')) { - return; - } - - var data = {}; - if (event.data) { - data = event.data.json(); - } - var title = data.title || "Something Has Happened"; - var message = data.message || "Here's something you might want to check out."; - var icon = "images/new-notification.png"; - - var notification = new Notification(title, { - body: message, - tag: 'simple-push-demo-notification', - icon: icon - }); - - notification.addEventListener('click', function() { - if (clients.openWindow) { - clients.openWindow('https://example.blog.com/2015/03/04/something-new.html'); - } - }); + if (!(self.Notification && self.notification.permission === 'granted')) { + return; + } + + var data = {}; + if (event.data) { + data = event.data.json(); + } + var title = data.title || "Something Has Happened"; + var message = data.message || "Here's something you might want to check out."; + var icon = "images/new-notification.png"; + + var notification = new Notification(title, { + body: message, + tag: 'simple-push-demo-notification', + icon: icon + }); + + notification.addEventListener('click', function() { + if (clients.openWindow) { + clients.openWindow('https://example.blog.com/2015/03/04/something-new.html'); + } + }); }); ``` |