Members
parsers LoaderParser[]
All loader parsers registered
Cache loading promises that ae currently active
Methods
Loads an asset(s) using the parsers added to the Loader.
Name | Type | Attributes | Description |
---|---|---|---|
assetsToLoadIn |
string | string[] | LoadAsset | LoadAsset[] |
urls that you want to load, or a single one! |
|
onProgress |
(progress: number) => void |
<optional> |
a function that gets called when the progress changes |
Returns:
Type | Description |
---|---|
Promise<{ [key: string]: any } | any> |
Examples
// single asset:
const asset = await Loader.load('cool.png');
console.log(asset);
// multiple assets:
const assets = await Loader.load(['cool.png', 'cooler.png']);
console.log(assets);
function used for testing
Unloads an asset(s). Any unloaded assets will be destroyed, freeing up memory for your app. The parser that created the asset, will be the one that unloads it.
Name | Type | Description |
---|---|---|
assetsToUnloadIn |
string | string[] | LoadAsset | LoadAsset[] |
urls that you want to unload, or a single one! |
Returns:
Type | Description |
---|---|
Promise<void> |
Example
// single asset:
const asset = await Loader.load('cool.png');
await Loader.unload('cool.png');
console.log(asset.destroyed); // true