Chromium Code Reviews| Index: chrome/common/extensions/docs/examples/api/notifications/background.js |
| diff --git a/chrome/common/extensions/docs/examples/api/notifications/background.js b/chrome/common/extensions/docs/examples/api/notifications/background.js |
| index 646063ee9c6b9e35582ca6de563469f19317cf2f..218ec2e50b267aadb1143a78ad0f2295e303ef74 100644 |
| --- a/chrome/common/extensions/docs/examples/api/notifications/background.js |
| +++ b/chrome/common/extensions/docs/examples/api/notifications/background.js |
| @@ -5,18 +5,16 @@ |
| /* |
| Displays a notification with the current time. Requires "notifications" |
| permission in the manifest file (or calling |
| - "webkitNotifications.requestPermission" beforehand). |
| + "Notification.requestPermission" beforehand). |
| */ |
| function show() { |
| var time = /(..)(:..)/.exec(new Date()); // The prettyprinted time. |
| var hour = time[1] % 12 || 12; // The prettyprinted hour. |
| var period = time[1] < 12 ? 'a.m.' : 'p.m.'; // The period of the day. |
| - var notification = window.webkitNotifications.createNotification( |
| - '48.png', // The image. |
| - hour + time[2] + ' ' + period, // The title. |
| - 'Time to make the toast.' // The body. |
| - ); |
| - notification.show(); |
| + new Notification(hour + time[2] + ' ' + period, { |
| + icon: '48.png', |
| + body: 'Time to make the toast.' |
| + }); |
| } |
| // Conditionally initialize the options. |
| @@ -27,7 +25,7 @@ if (!localStorage.isInitialized) { |
| } |
| // Test for notification support. |
| -if (window.webkitNotifications) { |
| +if ("Notification" in window) { |
|
not at google - send to devlin
2014/08/01 16:52:28
i preferred it the old way, "if (window.Notificati
tfarina
2014/08/02 00:54:05
Done.
|
| // While activated, show notifications at the display frequency. |
| if (JSON.parse(localStorage.isActivated)) { show(); } |