开发者

Javascript (Chrome extension) notification.cancel() is misbehaving

This is my simple function:

            if (req.status == 200)
            {

                var notification = webkitNotifications.createNotification(
                  'icon.png',  // icon url - can be relative
                  'Done!',  // notification title
                  'Just updated and saved the latest blocklist'  
                );
    开发者_C百科            notification.show();
                new_version_show_window();
                setTimeout( function () {  notification.cancel(); }, 4000);


            }

Basically its an AJAX call, once it downloads the list it shows the notification,

if its a new install or upgrade it calls ´new_version_show_window()´ and then it should close the notification... but it does not, sometimes it does, sometimes it does not :(


In couldn't make cancel() work properly either. For a workaround I created an html notification with the following javascript:

setTimeout( function () {  window.close(); }, 4000);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜