| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // Use an absolute path since this could be loaded from a different scope, | 5 // Use an absolute path since this could be loaded from a different scope, |
| 6 // which would affect the scope of the importScripts call here. | 6 // which would affect the scope of the importScripts call here. |
| 7 self.importScripts('/push_messaging/push_constants.js'); | 7 self.importScripts('/push_messaging/push_constants.js'); |
| 8 | 8 |
| 9 // Don't wait for clients of old SW to close before activating. |
| 10 self.addEventListener('install', () => skipWaiting()); |
| 11 |
| 9 var pushSubscriptionOptions = { | 12 var pushSubscriptionOptions = { |
| 10 userVisibleOnly: true | 13 userVisibleOnly: true |
| 11 }; | 14 }; |
| 12 | 15 |
| 13 // The "onpush" event currently understands two values as message payload | 16 // The "onpush" event currently understands two values as message payload |
| 14 // data coming from the test. Any other input is passed through to the | 17 // data coming from the test. Any other input is passed through to the |
| 15 // document unchanged. | 18 // document unchanged. |
| 16 // | 19 // |
| 17 // "shownotification" - Display a Web Notification with event.waitUntil(). | 20 // "shownotification" - Display a Web Notification with event.waitUntil(). |
| 18 // "shownotification-without-waituntil" | 21 // "shownotification-without-waituntil" |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 'data': data | 77 'data': data |
| 75 }); | 78 }); |
| 76 clients.matchAll().then(function(clients) { | 79 clients.matchAll().then(function(clients) { |
| 77 clients.forEach(function(client) { | 80 clients.forEach(function(client) { |
| 78 client.postMessage(message); | 81 client.postMessage(message); |
| 79 }); | 82 }); |
| 80 }, function(error) { | 83 }, function(error) { |
| 81 console.log(error); | 84 console.log(error); |
| 82 }); | 85 }); |
| 83 } | 86 } |
| OLD | NEW |