OLD | NEW |
(Empty) | |
| 1 // Service Worker to be used with the platform_notification_service.html page. |
| 2 var messagePort = null; |
| 3 |
| 4 addEventListener('message', function (event) { |
| 5 messagePort = event.data; |
| 6 messagePort.postMessage('ready'); |
| 7 }); |
| 8 |
| 9 // The notificationclick event will be invoked when a persistent notification |
| 10 // has been clicked on. When this happens, the title determines whether this |
| 11 // Service Worker has to act upon this. |
| 12 addEventListener('notificationclick', function (event) { |
| 13 if (event.notification.title == 'action_close') |
| 14 event.notification.close(); |
| 15 |
| 16 messagePort.postMessage(event.notification.title); |
| 17 }); |
OLD | NEW |