Class: AssetLoader

AssetLoader

AssetLoader allows loading of any sort of asset. It can be used to load several assets, but onComplete and onFail will be called for each.


new AssetLoader(ImporterType)

Parameters:
Name Type Description
ImporterType

ImporterType The type of importer to use for the asset. For example: JPG, HCM (material), OBJ, ... Do NOT pass in an instance, just the class name!

Author:
  • derschmale <http://www.derschmale.com>

Members


crossOrigin

Allow setting a cross-origin string when loading images.


fileMap

Key/value pairs that allows replacing file names with new ones.


options

Key/value pairs that specify options to be passed on to the Importers. See the importer documentation for details on which options can be set.

Methods


load(file [, target])

Loads the asset.

Parameters:
Name Type Argument Description
file

The filename/url to load, or a File object.

target <optional>

An optional empty target asset. This allows lazy loading.

Returns:

Immediately returns an empty version of the assets that will be populated eventually during parsing.

Type
*

setRequestHeader(name, value)

Set custom http request headers.

Parameters:
Name Type Description
name

The name of the header.

value

The value of the header.