如何在固定时间间隔内实现 chrome 扩展弹出桌面通知
How to implement a chrome extension popup desktop notification on fixed time interval
我希望chrome在固定的时间间隔内通知我。我尝试编写此代码,但只显示一次。
var notification = webkitNotifications.createNotification(
'icon.png',
'Free your eyes',
'Please take a break'
);
function showNotify()
{
notification.show();
setTimeout("showNotify()", 2000);
}
showNotify();
使用 setInterval()
定期运行代码。
尝试这样的事情:
function show() {
var notification = /* ... */
}
setInterval(show, 2000);
相关文章:
- chrome扩展中的navigator.geolocation.getCurrentPosition
- chrome扩展:尽管运行了at:documentidle,js脚本还是过早启动
- chrome扩展更改主机/域警告
- 如何在chrome扩展中重定向到html页面
- Chrome扩展没有't在重新加载之前考虑期权价值
- 如何通过自己获得Chrome扩展的用户反馈/错误报告
- 试图阻止Chrome通过扩展关闭
- 如何在chrome扩展中存储数据/结果,以及如何使用setTimeout使其只被调用一次
- 从选项页面更新chrome扩展清单权限
- 如何将chrome扩展功能移植到移动设备(特别是jquery和trello)
- Chrome扩展:遍历不同的页面并收集数据
- Chrome扩展 chrome.storage 如何同时进行大量获取和设置并避免竞争条件
- Chrome扩展:Chrome.tabs.executeScript不工作
- 中的访问扩展chrome://extensions页
- 如何在扩展Chrome DevTool时检索请求的启动器
- Chrome扩展-Chrome报警API为创建的每个新报警重新安排所有报警
- 是否有任何方法来扩展chrome's __commandLineAPI
- 谷歌Chrome扩展Chrome .tab . onupdate . addlistener
- 创建在页面上注入脚本的扩展chrome内容
- Chrome扩展:Chrome扩展中未定义的变量,即使它存在于控制台中