当前您正在分配
progress
到setInterval返回的任何值
.
chrome.notifications.update
:
var notifyStatus = function(title, message, timeout) {
chrome.notifications.create({
type: 'progress',
iconUrl: 'images/icon128.png',
title: title,
message: message || '',
progress: 0
}, function(id) {
// Automatically close the notification in 4 seconds by default
var progress = 0;
var interval = setInterval(function() {
if (++progress <= 100) {
chrome.notifications.update(id, {progress: progress}, function(updated) {
if (!updated) {
// the notification was closed
clearInterval(interval);
}
});
} else {
chrome.notifications.clear(id);
clearInterval(interval);
}
}, (timeout || 4000) / 100);
});
};