Constructor
new FileLoader(manageropt)
Constructs a new file loader.
Name | Type | Attributes | Description |
---|---|---|---|
manager | LoadingManager | <optional> | The loading manager. |
Extends
Members
crossOrigin :string
The crossOrigin string to implement CORS for loading the url from a different domain that allows CORS.
- string
- Overrides
- Default Value
- 'anonymous'
manager :LoadingManager
The loading manager.
- Overrides
- Default Value
- DefaultLoadingManager
mimeType :string
The expected mimeType. See FileLoader.setMimeType.
- string
- Default Value
- ''
path :string
The base path from which the asset will be loaded.
- string
- Overrides
- Default Value
- ''
requestHeader :object
The request header used in HTTP request.
- object
- Overrides
- Default Value
- {}
responseType :'arraybuffer'|'blob'|'document'|'json'|''
The expected response type. See FileLoader.setResponseType.
- 'arraybuffer' |
'blob' | 'document' | 'json' | ''
- Default Value
- ''
withCredentials :boolean
Whether the XMLHttpRequest uses credentials.
- boolean
- Overrides
- Default Value
- false
Methods
load(url, onLoadopt, onProgressopt, onErroropt)
Starts loading from the given URL and pass the loaded response to the onLoad()
callback.
Name | Type | Attributes | Description |
---|---|---|---|
url | string | — The path/URL of the file to be loaded. This can also be a data URI. | |
onLoad | function | <optional> | — Executed when the loading process has been finished. The argument is the loaded data. |
onProgress | onProgressCallback | <optional> | — Executed while the loading is in progress. |
onError | onErrorCallback | <optional> | — Executed when errors occur. |
- Overrides
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. |
- Overrides
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 |
- Overrides
A reference to this instance.
- Type:
- Loader
setMimeType(value) → {FileLoader}
Sets the expected mime type of the loaded file.
Name | Type | Description |
---|---|---|
value | string | The mime type. |
A reference to this file loader.
- Type:
- FileLoader
setPath(path) → {Loader}
Sets the base path for the asset.
Name | Type | Description |
---|---|---|
path | string | The base path. |
- Overrides
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. |
- Overrides
A reference to this instance.
- Type:
- Loader
setResponseType(value) → {FileLoader}
Sets the expected response type.
Name | Type | Description |
---|---|---|
value | 'arraybuffer' | | The response type. |
A reference to this file loader.
- Type:
- FileLoader
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 |
- Overrides
A reference to this instance.
- Type:
- Loader