1 | /**
|
2 | * @author mrdoob / http://mrdoob.com/
|
3 | */
|
4 |
|
5 | var Cache = {
|
6 |
|
7 | enabled: false,
|
8 |
|
9 | files: {},
|
10 |
|
11 | add: function ( key, file ) {
|
12 |
|
13 | if ( this.enabled === false ) return;
|
14 |
|
15 | // console.log( 'THREE.Cache', 'Adding key:', key );
|
16 |
|
17 | this.files[ key ] = file;
|
18 |
|
19 | },
|
20 |
|
21 | get: function ( key ) {
|
22 |
|
23 | if ( this.enabled === false ) return;
|
24 |
|
25 | // console.log( 'THREE.Cache', 'Checking key:', key );
|
26 |
|
27 | return this.files[ key ];
|
28 |
|
29 | },
|
30 |
|
31 | remove: function ( key ) {
|
32 |
|
33 | delete this.files[ key ];
|
34 |
|
35 | },
|
36 |
|
37 | clear: function () {
|
38 |
|
39 | this.files = {};
|
40 |
|
41 | }
|
42 |
|
43 | };
|
44 |
|
45 |
|
46 | export { Cache };
|