If I simplify my javascript code it is like this:
I have object which has method "dwnImage" responsible to download image from some url. When I call this method I would like that result of this method tell me if image was downloaded successfully or there were some error, like img doesn't exists, wrong url. How can I do that?
GM.Log=function(){
var imgLg=null;
var result=0;
var imgLoaded = function () {
result=1;
};
var init = function () {
imgLg= new Image(1,1);
imgLg.addEventListener('load', imgLoaded(), false);
}
var dwnImage=function(url){
imgLg.src=url;
return result;
}
return {
init: init
}
}
var test=new GM.Log();
test.init();
var result=test.dwnImage("http://...");