Commit a3635a5d authored by ronald's avatar ronald

if index >= length, output notifications

parent 395b4c9c
'use strict';
var initial = 0;
var index = 0;
var skus = [];
var noImages = "";
......@@ -19,22 +19,21 @@ chrome.extension.onMessage.addListener(function(request,sender,sendResponse){
console.log(skus);
} else if(request.nothing == "true") {
console.log("Message : nothing ");
noImages += (request.currentSku + ": no duplicate files\n");
initial++;
index++;
} else if(request.noImage == "true") {
console.log("Message : noImages");
noImages += (request.currentSku + ": no results/ no valid images\n");
initial += 2;
index += 2;
}
console.log("Current index : ", initial);
console.log("Current index : ", index);
console.log("Current noImages : " , noImages);
});
chrome.downloads.onDeterminingFilename.addListener(function(item, suggest) {
var new_filename = skus[initial] + ".zip";
var new_filename = skus[index] + ".zip";
suggest({filename: new_filename});
initial++;
if(skus.length-1 == initial) {
index++;
if(index >= skus.length-1) {
console.log("Last file was downloaded");
alert(noImages);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment