chrome.notifications.update does not work as expected

I have some progress notifications and I simply want it to be updated, but it goest from 0% to 1%, and then staies there, at 1%.

here my code:

var notifId = uuidv4();
    var i = 0;
    var notifOptions = {
        type: 'progress',
        iconUrl: 'img/GS icon.png',
        title: 'test',
        progress: i,
        requireInteraction: true,
        message: 'Downloading...',
        buttons: [{
            title: 'Abort download'
        }]
    };
    chrome.notifications.create(notifId, notifOptions);
    setInterval(function () {
            chrome.notifications.update(notifId, {
                progress: ++i % 100
            }, function () {});
        },
        1000);

where

//create a unique id for eatch notification
function uuidv4() {
    return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
        var r = Math.random() * 16 | 0,
            v = c == 'x' ? r : (r & 0x3 | 0x8);
        return v.toString(16);
    });
}

what' the problem? why it stucks on 1% ?

Answers:

Tags

Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us Javascript

©2020 All rights reserved.