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..cbe9d53d6d66d0c6b9713e0d5a05a25846c6c1b1 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 (window.Notification) { |
// While activated, show notifications at the display frequency. |
if (JSON.parse(localStorage.isActivated)) { show(); } |