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'
);
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: