1 | import { DefaultLoadingManager } from './LoadingManager.js';
|
2 |
|
3 | function Loader( manager ) {
|
4 |
|
5 | this.manager = ( manager !== undefined ) ? manager : DefaultLoadingManager;
|
6 |
|
7 | this.crossOrigin = 'anonymous';
|
8 | this.withCredentials = false;
|
9 | this.path = '';
|
10 | this.resourcePath = '';
|
11 | this.requestHeader = {};
|
12 |
|
13 | }
|
14 |
|
15 | Object.assign( Loader.prototype, {
|
16 |
|
17 | load: function ( /* url, onLoad, onProgress, onError */ ) {},
|
18 |
|
19 | loadAsync: function ( url, onProgress ) {
|
20 |
|
21 | const scope = this;
|
22 |
|
23 | return new Promise( function ( resolve, reject ) {
|
24 |
|
25 | scope.load( url, resolve, onProgress, reject );
|
26 |
|
27 | } );
|
28 |
|
29 | },
|
30 |
|
31 | parse: function ( /* data */ ) {},
|
32 |
|
33 | setCrossOrigin: function ( crossOrigin ) {
|
34 |
|
35 | this.crossOrigin = crossOrigin;
|
36 | return this;
|
37 |
|
38 | },
|
39 |
|
40 | setWithCredentials: function ( value ) {
|
41 |
|
42 | this.withCredentials = value;
|
43 | return this;
|
44 |
|
45 | },
|
46 |
|
47 | setPath: function ( path ) {
|
48 |
|
49 | this.path = path;
|
50 | return this;
|
51 |
|
52 | },
|
53 |
|
54 | setResourcePath: function ( resourcePath ) {
|
55 |
|
56 | this.resourcePath = resourcePath;
|
57 | return this;
|
58 |
|
59 | },
|
60 |
|
61 | setRequestHeader: function ( requestHeader ) {
|
62 |
|
63 | this.requestHeader = requestHeader;
|
64 | return this;
|
65 |
|
66 | }
|
67 |
|
68 | } );
|
69 |
|
70 | export { Loader };
|