@@ -17,8 +17,6 @@ var BaseLoader = function ()
1717
1818 this . events = new EventDispatcher ( ) ;
1919
20- this . forceImageTags = false ;
21-
2220 // Move to a 'setURL' method?
2321 this . baseURL = '' ;
2422 this . path = '' ;
@@ -36,7 +34,6 @@ var BaseLoader = function ()
3634 this . inflight = new Set ( ) ;
3735 this . failed = new Set ( ) ;
3836 this . queue = new Set ( ) ;
39-
4037 this . storage = new Set ( ) ;
4138
4239 this . _state = CONST . LOADER_IDLE ;
@@ -193,7 +190,7 @@ BaseLoader.prototype = {
193190
194191 finishedLoading : function ( )
195192 {
196- console . log ( 'BaseLoader.finishedLoading PROCESSING' ) ;
193+ // console.log('BaseLoader.finishedLoading PROCESSING', this.queue.size, 'files ');
197194
198195 this . _state = CONST . LOADER_PROCESSING ;
199196
@@ -211,9 +208,18 @@ BaseLoader.prototype = {
211208
212209 processUpdate : function ( file )
213210 {
214- this . storage . add ( file ) ;
211+ if ( file . state === CONST . FILE_ERRORED )
212+ {
213+ this . failed . add ( file ) ;
214+ }
215+ else
216+ {
217+ this . storage . add ( file ) ;
218+ }
215219
216- if ( this . storage . size === this . queue . size && this . _state === CONST . LOADER_PROCESSING )
220+ this . queue . delete ( file ) ;
221+
222+ if ( this . queue . size === 0 && this . _state === CONST . LOADER_PROCESSING )
217223 {
218224 // We've processed all the files we loaded
219225 this . processComplete ( ) ;
@@ -226,18 +232,18 @@ BaseLoader.prototype = {
226232 this . inflight . clear ( ) ;
227233 this . queue . clear ( ) ;
228234
229- console . log ( 'Loader Process Complete. Loaded:' , this . storage . size , 'Failed:' , this . failed . size ) ;
235+ console . log ( 'Loader Complete. Loaded:' , this . storage . size , 'Failed:' , this . failed . size ) ;
236+
237+ if ( this . processCallback )
238+ {
239+ this . processCallback ( ) ;
240+ }
230241
231242 this . _state = CONST . LOADER_COMPLETE ;
232243
233244 this . events . dispatch ( new Event . LOADER_COMPLETE_EVENT ( this ) ) ;
234245 } ,
235246
236- getLoadedFiles : function ( )
237- {
238- return this . storage . slice ( ) ;
239- } ,
240-
241247 reset : function ( )
242248 {
243249 this . list . clear ( ) ;
0 commit comments