Module: assets

Low-level resource loader. In order to load exported scenes, use the data module instead.

Summary

Members

Methods

Type Definitions

Detailed Description

Members

AT_ARRAYBUFFER

Asset type: ArrayBuffer
Source:

AT_AUDIO_ELEMENT

Asset type: HTMLAudioElement
Source:

AT_AUDIOBUFFER

Asset type: AudioBuffer
Source:

AT_IMAGE_ELEMENT

Asset type: HTMLImageElement
Source:

AT_JSON

Asset type: JSON
Source:

AT_TEXT

Asset type: Text
Source:

Methods

enqueue(assets_pack, asset_cbopt, pack_cbopt, progress_cbopt)

Add the assets to the loading queue.
Parameters:
Name Type Attributes Description
assets_pack Array.<Asset> Array of the loading assets
asset_cb AssetCallback <optional>
Callback executed after a single asset is loaded
pack_cb PackCallback <optional>
Callback executed after the whole pack of assets is loaded
progress_cb ProgressCallback <optional>
Callback for the progress of loading
Source:

Type Definitions

Asset

Loading asset. Asset has the following structure: [uri, type, filepath, optional_param], where uri - asset identifier, type - asset type, filepath - path to resource (URL), optional_param - any param passed to module:assets~AssetCallback
Type:
  • Array
Source:

AssetCallback(data, uri, type, filepath, optional_paramopt)

Callback executed after a single asset is loaded.
Parameters:
Name Type Attributes Description
data Data Loaded data
uri String Data asset ID
type Number Data type
filepath String Data filepath
optional_param * <optional>
Optional parameter
Source:

PackCallback()

Callback executed after the whole pack of assets is loaded.
Source:

ProgressCallback(value)

Callback for the progress of loading.
Parameters:
Name Type Description
value Number Loading percentage
Source: