A loadable asset base class. All asset types inherit from this.
Kind: global class
Boolean
String
Boolean
Promise
Promise
Promise
Create the new asset.
Param | Type | Description |
---|---|---|
url | String |
Asset URL / identifier. |
Boolean
Get if this asset is ready, ie loaded or created.
Kind: instance property of Asset
Returns: Boolean
- True if asset finished loading / creating. This doesn’t mean its necessarily valid, only that its done loading.
String
Get asset’s URL.
Kind: instance property of Asset
Returns: String
- Asset URL.
Boolean
Get if this asset is loaded and valid.
Kind: instance property of Asset
Returns: Boolean
- True if asset is loaded and valid, false otherwise.
Register a method to be called when asset is ready. If asset is already in ready state, will invoke immediately.
Kind: instance method of Asset
Param | Type | Description |
---|---|---|
callback | function |
Callback to invoke when asset is ready. |
Promise
Return a promise to resolve when ready.
Kind: instance method of Asset
Returns: Promise
- Promise to resolve when ready.
Promise
Load the asset from it’s URL.
Kind: instance method of Asset
Returns: Promise
- Promise to resolve when fully loaded.
Param | Type | Description |
---|---|---|
params | \* |
Optional additional params. |
Promise
Create the asset from data source.
Kind: instance method of Asset
Returns: Promise
- Promise to resolve when asset is ready.
Param | Type | Description |
---|---|---|
source | \* |
Data to create asset from. |
params | \* |
Optional additional params. |
Destroy the asset, freeing any allocated resources in the process.
Kind: instance method of Asset