Cache.js 549 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. /**
  2. * @author mrdoob / http://mrdoob.com/
  3. */
  4. var Cache = {
  5. enabled: false,
  6. files: {},
  7. add: function ( key, file ) {
  8. if ( this.enabled === false ) return;
  9. // console.log( 'THREE.Cache', 'Adding key:', key );
  10. this.files[ key ] = file;
  11. },
  12. get: function ( key ) {
  13. if ( this.enabled === false ) return;
  14. // console.log( 'THREE.Cache', 'Checking key:', key );
  15. return this.files[ key ];
  16. },
  17. remove: function ( key ) {
  18. delete this.files[ key ];
  19. },
  20. clear: function () {
  21. this.files = {};
  22. }
  23. };
  24. export { Cache };