Loader
The Loader class is used to preload files
Constructor Summary
Public Constructor | ||
public |
Creates an instance of the Loader class |
Method Summary
Public Methods | ||
public |
Create a new instance of the Loader |
|
public |
Returns a load file by id |
|
public |
Returns the cache containing the preloaded files |
|
public |
Load a list of files |
|
public |
preloadAudio(id: String, url: String, audio: Audio): Promise Preload an audio file |
|
public |
preloadFile(id: String, url: String, request: XMLHttpRequest): Promise Preload a file using HTTPRequest |
|
public |
preloadImage(id: String, url: String, image: Image): Promise Preload an image |
Public Constructors
Public Methods
public get(id: String): Object source
Returns a load file by id
Params:
Name | Type | Attribute | Description |
id | String |
public preload(files: Object, progress: Function): Promise source
Load a list of files
Params:
Name | Type | Attribute | Description |
files | Object | Contains a list of files to load with the following structure: { "file1": "url1", "file2": "url2" } or { "file1": { type: "image|audio|file", url: "url1", obj: objectLoader|null } } |
|
progress | Function | A callback function with the parameters: "err, id, data, loaded, total" |
Return:
Promise | Returns a promise which is resolved upon loading all files, doesn't matter if they failed or not |
public preloadFile(id: String, url: String, request: XMLHttpRequest): Promise source
Preload a file using HTTPRequest