47 lines
549 B
JavaScript
47 lines
549 B
JavaScript
|
/**
|
||
|
* @author mrdoob / http://mrdoob.com/
|
||
|
*/
|
||
|
|
||
|
var Cache = {
|
||
|
|
||
|
enabled: false,
|
||
|
|
||
|
files: {},
|
||
|
|
||
|
add: function ( key, file ) {
|
||
|
|
||
|
if ( this.enabled === false ) return;
|
||
|
|
||
|
// console.log( 'THREE.Cache', 'Adding key:', key );
|
||
|
|
||
|
this.files[ key ] = file;
|
||
|
|
||
|
},
|
||
|
|
||
|
get: function ( key ) {
|
||
|
|
||
|
if ( this.enabled === false ) return;
|
||
|
|
||
|
// console.log( 'THREE.Cache', 'Checking key:', key );
|
||
|
|
||
|
return this.files[ key ];
|
||
|
|
||
|
},
|
||
|
|
||
|
remove: function ( key ) {
|
||
|
|
||
|
delete this.files[ key ];
|
||
|
|
||
|
},
|
||
|
|
||
|
clear: function () {
|
||
|
|
||
|
this.files = {};
|
||
|
|
||
|
}
|
||
|
|
||
|
};
|
||
|
|
||
|
|
||
|
export { Cache };
|