Constructor
(abstract) new Loader(manageropt)
Constructs a new Loader.
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
manager | LoadingManager | <optional> | DefaultLoadingManager | The loading manager. |
Members
crossOrigin :string
The crossOrigin string to implement CORS for loading the url from a different domain that allows CORS.
- string
- Default Value
- 'anonymous'
manager :LoadingManager
The loading manager.
- Default Value
- DefaultLoadingManager
path :string
The base path from which the asset will be loaded.
- string
- Default Value
- ''
requestHeader :object
The request header used in HTTP request.
- object
- Default Value
- {}
withCredentials :boolean
Whether the XMLHttpRequest uses credentials.
- boolean
- Default Value
- false
Methods
load(url, onLoad, onProgressopt, onErroropt)
This method needs to be implement by all concrete loaders. It holds the logic for loading the asset from the backend.
Name | Type | Attributes | Description |
---|---|---|---|
url | string | The path/URL of the file to be loaded. | |
onLoad | function | Executed when the loading process has been finished. | |
onProgress | onProgressCallback | <optional> | Executed while the loading is in progress. |
onError | onErrorCallback | <optional> | Executed when errors occur. |
loadAsync(url, onProgressopt) → {Promise}
A async version of Loader#load.
Name | Type | Attributes | Description |
---|---|---|---|
url | string | The path/URL of the file to be loaded. | |
onProgress | function | <optional> | Executed while the loading is in progress. |
A Promise that resolves when the asset has been loaded.
- Type:
- Promise
setCrossOrigin(crossOrigin) → {Loader}
Sets the crossOrigin
String to implement CORS for loading the URL from a different domain that allows CORS.
Name | Type | Description |
---|---|---|
crossOrigin | string | The |
A reference to this instance.
- Type:
- Loader
setPath(path) → {Loader}
Sets the base path for the asset.
Name | Type | Description |
---|---|---|
path | string | The base path. |
A reference to this instance.
- Type:
- Loader
setRequestHeader(requestHeader) → {Loader}
Sets the given request header.
Name | Type | Description |
---|---|---|
requestHeader | object | A request header for configuring the HTTP request. |
A reference to this instance.
- Type:
- Loader
setWithCredentials(value) → {Loader}
Whether the XMLHttpRequest uses credentials such as cookies, authorization headers or TLS client certificates, see XMLHttpRequest.withCredentials. Note: This setting has no effect if you are loading files locally or from the same domain.
Name | Type | Description |
---|---|---|
value | boolean | The |
A reference to this instance.
- Type:
- Loader