ResourceHandler
Summary
Methods
[patch] | Optional function to perform any operations on a resource, that requires a dependency on its asset data or any other asset data. |
load | Load a resource from a remote URL. |
open | Convert raw resource data into a resource instance. |
Details
Constructor
ResourceHandler()
Interface for ResourceHandlers used by ResourceLoader.
Methods
[patch](asset, assets)
Optional function to perform any operations on a resource, that requires a dependency on its asset data or any other asset data.
Parameters
asset | Asset | The asset to patch. |
assets | AssetRegistry | The asset registry. |
load(url, callback, [asset])
Load a resource from a remote URL. When loaded (or failed), use the callback to return an the raw resource data (or error).
Parameters
url | string, object | Either the URL of the resource to load or a structure containing the load and original URL. |
url.load | string | The URL to be used for loading the resource. |
url.original | string | The original URL to be used for identifying the resource format. This is necessary when loading, for example from blob. |
callback | ResourceHandlerCallback | The callback used when the resource is loaded or an error occurs. |
asset | Asset | Optional asset that is passed by ResourceLoader. |
open(url, data, [asset])
Convert raw resource data into a resource instance. E.g. Take 3D model format JSON and return a Model.
Parameters
url | string | The URL of the resource to open. |
data | * | The raw resource data passed by callback from ResourceHandler#load. |
asset | Asset | Optional asset that is passed by ResourceLoader. |
Returns
*The parsed resource data.