Chrome extension development: auto close the notification box

前端 未结 5 920
眼角桃花
眼角桃花 2021-01-02 16:35

After doing something I run this code:

var notification = webkitNotifications.createNotification(
   \'icon.png\',  // icon url - can be relative
  \'Done!\'         


        
5条回答
  •  无人及你
    2021-01-02 17:18

    var notification = webkitNotifications.createNotification('images/icon-48x48.png',"This is       Title","Biswarup Adhikari Notification");
    notification.show();
    setTimeout(function(){
    notification.cancel();
    },2000);
    

    Chrome notification will close automatically after 2000 milli sec or 2 sec.

提交回复
热议问题