varImageLoader=function(a,b){this._wrapper=ainstanceofHTMLImageElement?a:null;this._src=this.src=null;this._callback="function"!=typeofb?function(){}:b;this._process="function"!=typeofprocess?function(){}:process;this._loaded=!1;if(!this._wrapper)throwError("Param 1 expected to be an HTMLImageElement (<img>), but "+a.constructor.name+" received");this.__defineSetter__("src",function(a){log("src update","[ImageLoader]");this._src=a;this._load()});this.__defineGetter__("src",function(){returnthis._src});
ImageLoader.prototype._load=function(){if(!this._loaded)throwError("image tree not loaded yet");if("string"!=typeofthis.src)throwError("ImageLoader.src expected to be a <String>");if("function"!=typeofthis._callback)throwError("ImageLoader.callback expected to be a <Function>");if(~this._images.indexOf(this.src))returnthis._wrapper.addEventListener("load",this._process.bind(this._wrapper),!1),this._wrapper.src="./pictures/"+this.src,!0;console.warn("Resource "+this.src+" not found!")};