Updated the docs about the data parameter

This commit is contained in:
Richard Davey 2021-11-03 18:50:28 +00:00
parent a00f88a786
commit dc73546048
2 changed files with 19 additions and 15 deletions

View file

@ -6,18 +6,20 @@
/**
* The File Load Complete Event.
*
* This event is dispatched by the Loader Plugin when any file in the queue finishes loading.
*
*
* This event is dispatched by the Loader Plugin when _any_ file in the queue finishes loading.
*
* Listen to it from a Scene using: `this.load.on('filecomplete', listener)`.
*
*
* Make sure you remove this listener when you have finished, or it will continue to fire if the Scene reloads.
*
* You can also listen for the completion of a specific file. See the [FILE_KEY_COMPLETE]{@linkcode Phaser.Loader.Events#event:FILE_KEY_COMPLETE} event.
*
* @event Phaser.Loader.Events#FILE_COMPLETE
* @since 3.0.0
*
*
* @param {string} key - The key of the file that just loaded and finished processing.
* @param {string} type - The [file type]{@link Phaser.Loader.File#type} of the file that just loaded, i.e. `image`.
* @param {any} data - The raw data the file contained.
* @param {any} [data] - The raw data the file contained. If the file was a multi-file, like an atlas or bitmap font, this parameter will be undefined.
*/
module.exports = 'filecomplete';

View file

@ -6,11 +6,11 @@
/**
* The File Load Complete Event.
*
*
* This event is dispatched by the Loader Plugin when any file in the queue finishes loading.
*
*
* It uses a special dynamic event name constructed from the key and type of the file.
*
*
* For example, if you have loaded an `image` with a key of `monster`, you can listen for it
* using the following:
*
@ -21,28 +21,30 @@
* ```
*
* Or, if you have loaded a texture `atlas` with a key of `Level1`:
*
*
* ```javascript
* this.load.on('filecomplete-atlas-Level1', function (key, type, data) {
* // Your handler code
* });
* ```
*
*
* Or, if you have loaded a sprite sheet with a key of `Explosion` and a prefix of `GAMEOVER`:
*
*
* ```javascript
* this.load.on('filecomplete-spritesheet-GAMEOVERExplosion', function (key, type, data) {
* // Your handler code
* });
* ```
*
*
* Make sure you remove your listeners when you have finished, or they will continue to fire if the Scene reloads.
*
* You can also listen for the generic completion of files. See the [FILE_COMPLETE]{@linkcode Phaser.Loader.Events#event:FILE_COMPLETE} event.
*
* @event Phaser.Loader.Events#FILE_KEY_COMPLETE
* @since 3.0.0
*
*
* @param {string} key - The key of the file that just loaded and finished processing.
* @param {string} type - The [file type]{@link Phaser.Loader.File#type} of the file that just loaded, i.e. `image`.
* @param {any} data - The raw data the file contained.
* @param {any} [data] - The raw data the file contained. If the file was a multi-file, like an atlas or bitmap font, this parameter will be undefined.
*/
module.exports = 'filecomplete-';