Chrome extension development: auto close the notification box

Ryan picture Ryan · Apr 20, 2011 · Viewed 10.1k times · Source

After doing something I run this code:

var notification = webkitNotifications.createNotification(
   'icon.png',  // icon url - can be relative
  'Done!',  // notification title
  'Just updated your list!'  // notification body text
   );
  notification.show();

which of course pops up a notification into the users screen.

It there anyway to time this notification so that it auto-closes in X amount of seconds?

Thanks! R

Answer

qiufangzhou picture qiufangzhou · May 13, 2011

You can use notification.cancel();