Abstract
Creates a new AcCmLoader instance.
Optional
manager: AcCmLoadingManagerThe loadingManager for the loader to use. Default is DefaultLoadingManager.
The crossOrigin string to implement CORS for loading the url from a different domain that allows CORS. Default is anonymous.
The base path from which the asset will be loaded. Default is the empty string.
The request header used in HTTP request.
The base path from which additional resources like textures will be loaded. Default is the empty string.
Whether the XMLHttpRequest uses credentials. Default is false.
Abstract
loadThis method needs to be implement by all concrete loaders. It holds the logic for loading the asset from the backend.
The path or URL to the file. This can also be a Data URI.
Optional
onLoad: (data: unknown) => void(optional) — Will be called when loading completes.
Optional
onProgress: AcCmLoaderProgressCallback(optional) — Will be called while load progresses.
Optional
onError: AcCmOnErrorCallback(optional) — Will be called if an error occurs.
This method is equivalent to 'load', but returns a Promise.
A string containing the path/URL of the file to be loaded.
(optional) — A function to be called while the loading is in progress. The argument will be the ProgressEvent instance, which contains .lengthComputable, .total and .loaded. If the server does not set the Content-Length header; .total will be 0.
Return a promise.
Set the crossOrigin string to implement CORS for loading the url from a different domain that allows CORS.
The crossOrigin string
Return this object
Set the base path for the asset.
The base path for the asset.
Return this object
Set the request header used in HTTP request.
key: The name of the header whose value is to be set. value: The value to set as the body of the header.
Return this object
Set the base path for dependent resources like textures.
The base path for dependent resources like textures.
Return this object
Set whether the XMLHttpRequest uses credentials such as cookies, authorization headers or TLS client certificates. Note that this has no effect if you are loading files locally or from the same domain.
The flag whether the XMLHttpRequest uses credentials.
Return this object
Abstract base class for implementing resource loaders.
This class provides the common functionality and interface that all loaders must implement, including loading manager integration, path handling, and configuration options for cross-origin requests.
Example