21 lines
658 B
JavaScript
21 lines
658 B
JavaScript
|
|
||
|
/* CONSTRUCTEUR
|
||
|
*/
|
||
|
var ImageLoader = function(imageElement){
|
||
|
/* [0] Initialisation + paramètres
|
||
|
=========================================================*/
|
||
|
this.wrapper = (imageElement instanceof HTMLImageElement) ? imageElement : null;
|
||
|
|
||
|
if( !this.wrapper )
|
||
|
throw new Error('Param 1 expected to be an HTMLImageElement (<img>), but '+imageElement.constructor.name+' received');
|
||
|
|
||
|
/* [1] Chargement du tree d'images
|
||
|
=========================================================*/
|
||
|
this.treeLoaded = false;
|
||
|
|
||
|
AJAX.send('./pictures/index.php', (function(response){
|
||
|
this.treeLoaded = true;
|
||
|
console.log( JSON.parse(response) );
|
||
|
}).bind(this), 'GET');
|
||
|
};
|