Chrome扩展程序开发:自动关闭通知框 [英] Chrome extension development: auto close the notification box

查看:290
本文介绍了Chrome扩展程序开发:自动关闭通知框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

运行以下代码后:

  var notification = webkitNotifications.createNotification(
'icon.png ',// icon url - 可以是相对的
'Done!',//通知标题
'刚刚更新了你的列表!'//通知正文文本
);
notification.show();

这当然会弹出一个通知到用户屏幕。



无论如何,要通知这个通知以便在X秒内自动关闭?



谢谢!
R

解决方案

您可以使用 notification.cancel();


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

解决方案

You can use notification.cancel();

这篇关于Chrome扩展程序开发:自动关闭通知框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆