forked from UL-FRI-LGM/RenderCore
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCache.js
More file actions
33 lines (26 loc) · 641 Bytes
/
Cache.js
File metadata and controls
33 lines (26 loc) · 641 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
/**
* Created by Primoz on 17.3.2016.
* Source: Three.js
*/
/**
* This is a global object that can be used for caching the loaded files. Caching is disabled by default, but it is
* advised to enable it when loading the same file multiple times during a single session.
*/
export var Cache = {
enabled: false,
files: {},
add: function ( key, file ) {
if ( this.enabled === false ) return;
this.files[ key ] = file;
},
get: function ( key ) {
if ( this.enabled === false ) return;
return this.files[ key ];
},
remove: function ( key ) {
delete this.files[ key ];
},
clear: function () {
this.files = {};
}
};