Cache.js 503 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. const Cache = {
  2. enabled: false,
  3. files: {},
  4. add: function ( key, file ) {
  5. if ( this.enabled === false ) return;
  6. // console.log( 'THREE.Cache', 'Adding key:', key );
  7. this.files[ key ] = file;
  8. },
  9. get: function ( key ) {
  10. if ( this.enabled === false ) return;
  11. // console.log( 'THREE.Cache', 'Checking key:', key );
  12. return this.files[ key ];
  13. },
  14. remove: function ( key ) {
  15. delete this.files[ key ];
  16. },
  17. clear: function () {
  18. this.files = {};
  19. }
  20. };
  21. export { Cache };
粤ICP备19079148号