OLD | NEW |
(Empty) | |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 // Service Worker to be used with the platform_notification_service.html page. |
| 6 var messagePort = null; |
| 7 |
| 8 addEventListener('message', function (event) { |
| 9 messagePort = event.data; |
| 10 messagePort.postMessage('ready'); |
| 11 }); |
| 12 |
| 13 // The notificationclick event will be invoked when a persistent notification |
| 14 // has been clicked on. When this happens, the title determines whether this |
| 15 // Service Worker has to act upon this. |
| 16 addEventListener('notificationclick', function (event) { |
| 17 if (event.notification.title == 'action_close') |
| 18 event.notification.close(); |
| 19 |
| 20 messagePort.postMessage(event.notification.title); |
| 21 }); |
OLD | NEW |