@@ -127,12 +127,10 @@ JPAK.jpakloader = function(parameters) {
127127 this . jpakfile = parameters . file ;
128128 this . loadall = parameters . loadall || false ; // TODO: Implement the fetch-on-need feature
129129 }
130+ this . filecache = [ ] ;
131+ this . dataloaded = false ;
130132} ;
131133
132- // Variables
133- JPAK . jpakloader . prototype . dataloaded = false ; // Set to true, when file is loaded
134- JPAK . jpakloader . prototype . filecache = [ ] ; // The cached files that we loaded
135-
136134// Searches a file on the cache
137135JPAK . jpakloader . prototype . CacheLoad = function ( path ) {
138136 for ( var i = 0 ; i < this . filecache . length ; i ++ ) {
@@ -264,7 +262,7 @@ JPAK.jpakloader.prototype.GetFile = function(path, type) {
264262 if ( file . compressed !== undefined && file . compressed )
265263 dataslice = JPAK . GZIP . decompress ( dataslice ) ;
266264 var blob = new Blob ( [ new Uint8Array ( dataslice ) . buffer ] , { "type" :type } ) ;
267- this . filecache . push ( { "path" :path , "type" :type , "blob" :blob , "url" :URL . createObjectURL ( blob ) , "arraybuffer" : this . jpakdata . slice ( file . offset , file . offset + file . size ) } ) ;
265+ this . filecache . push ( { "path" :path , "type" :type , "blob" :blob , "url" :URL . createObjectURL ( blob ) , "arraybuffer" : dataslice } ) ;
268266 return blob ;
269267 } else if ( cache != undefined )
270268 return cache . blob ;
@@ -299,7 +297,7 @@ JPAK.jpakloader.prototype.GetFileArrayBuffer = function(path, type) {
299297 if ( file . compressed !== undefined && file . compressed )
300298 dataslice = JPAK . GZIP . decompress ( dataslice ) ;
301299 var blob = new Blob ( [ new Uint8Array ( dataslice ) . buffer ] , { "type" :type } ) ;
302- this . filecache . push ( { "path" :path , "type" :type , "blob" :blob , "url" :URL . createObjectURL ( blob ) , "arraybuffer" : arraybuffer } ) ;
300+ this . filecache . push ( { "path" :path , "type" :type , "blob" :blob , "url" :URL . createObjectURL ( blob ) , "arraybuffer" : dataslice } ) ;
303301 return dataslice ;
304302 } else if ( cache != undefined )
305303 return cache . arraybuffer ;
0 commit comments