Skip to content

Commit 43f26ad

Browse files
committed
Update JSDocs for events
1 parent 88b088b commit 43f26ad

35 files changed

Lines changed: 384 additions & 379 deletions

plugins/spine/src/SpinePlugin.js

Lines changed: 111 additions & 111 deletions
Large diffs are not rendered by default.

src/core/Game.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,7 @@ var Game = new Class({
389389
*
390390
* @method Phaser.Game#texturesReady
391391
* @private
392-
* @fires Phaser.Game#ready
392+
* @fires Phaser.Game#READY
393393
* @since 3.12.0
394394
*/
395395
texturesReady: function ()
@@ -443,11 +443,11 @@ var Game = new Class({
443443
* It will then render each Scene in turn, via the Renderer. This process emits `prerender` and `postrender` events.
444444
*
445445
* @method Phaser.Game#step
446-
* @fires Phaser.Core.Events#PRE_STEP_EVENT
447-
* @fires Phaser.Core.Events#STEP_EVENT
448-
* @fires Phaser.Core.Events#POST_STEP_EVENT
449-
* @fires Phaser.Core.Events#PRE_RENDER_EVENT
450-
* @fires Phaser.Core.Events#POST_RENDER_EVENT
446+
* @fires Phaser.Core.Events#PRE_STEP
447+
* @fires Phaser.Core.Events#PRE_STEP
448+
* @fires Phaser.Core.Events#POST_STEP
449+
* @fires Phaser.Core.Events#PRE_RENDER
450+
* @fires Phaser.Core.Events#POST_RENDER
451451
* @since 3.0.0
452452
*
453453
* @param {number} time - The current time. Either a High Resolution Timer value if it comes from Request Animation Frame, or Date.now if using SetTimeout.
@@ -510,8 +510,8 @@ var Game = new Class({
510510
* This process emits `prerender` and `postrender` events, even though nothing actually displays.
511511
*
512512
* @method Phaser.Game#headlessStep
513-
* @fires Phaser.Game#prerenderEvent
514-
* @fires Phaser.Game#postrenderEvent
513+
* @fires Phaser.Game#PRE_RENDER
514+
* @fires Phaser.Game#POST_RENDER
515515
* @since 3.2.0
516516
*
517517
* @param {number} time - The current time. Either a High Resolution Timer value if it comes from Request Animation Frame, or Date.now if using SetTimeout.
@@ -672,7 +672,7 @@ var Game = new Class({
672672
runDestroy: function ()
673673
{
674674
this.scene.destroy();
675-
675+
676676
this.events.emit(Events.DESTROY);
677677

678678
this.events.removeAllListeners();

src/gameobjects/components/Animation.js

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -297,14 +297,14 @@ var Animation = new Class({
297297

298298
/**
299299
* Sets an animation to be played immediately after the current one completes.
300-
*
300+
*
301301
* The current animation must enter a 'completed' state for this to happen, i.e. finish all of its repeats, delays, etc, or have the `stop` method called directly on it.
302-
*
302+
*
303303
* An animation set to repeat forever will never enter a completed state.
304-
*
304+
*
305305
* You can chain a new animation at any point, including before the current one starts playing, during it, or when it ends (via its `animationcomplete` callback).
306306
* Chained animations are specific to a Game Object, meaning different Game Objects can have different chained animations without impacting the global animation they're playing.
307-
*
307+
*
308308
* Call this method with no arguments to reset the chained animation.
309309
*
310310
* @method Phaser.GameObjects.Components.Animation#chain
@@ -496,7 +496,7 @@ var Animation = new Class({
496496

497497
/**
498498
* Plays an Animation on a Game Object that has the Animation component, such as a Sprite.
499-
*
499+
*
500500
* Animations are stored in the global Animation Manager and are referenced by a unique string-based key.
501501
*
502502
* @method Phaser.GameObjects.Components.Animation#play
@@ -570,9 +570,9 @@ var Animation = new Class({
570570
* Load an Animation and fires 'onStartEvent' event, extracted from 'play' method.
571571
*
572572
* @method Phaser.GameObjects.Components.Animation#_startAnimation
573-
* @fires Phaser.Animations.Events#START_ANIMATION_EVENT
574-
* @fires Phaser.Animations.Events#SPRITE_START_ANIMATION_EVENT
575-
* @fires Phaser.Animations.Events#SPRITE_START_KEY_ANIMATION_EVENT
573+
* @fires Phaser.Animations.Events#ANIMATION_START
574+
* @fires Phaser.Animations.Events#SPRITE_ANIMATION_START
575+
* @fires Phaser.Animations.Events#SPRITE_ANIMATION_KEY_START
576576
* @since 3.12.0
577577
*
578578
* @param {string} key - The string-based key of the animation to play, as defined previously in the Animation Manager.
@@ -777,9 +777,9 @@ var Animation = new Class({
777777
* Restarts the current animation from its beginning, optionally including its delay value.
778778
*
779779
* @method Phaser.GameObjects.Components.Animation#restart
780-
* @fires Phaser.Animations.Events#RESTART_ANIMATION_EVENT
781-
* @fires Phaser.Animations.Events#SPRITE_RESTART_ANIMATION_EVENT
782-
* @fires Phaser.Animations.Events#SPRITE_RESTART_KEY_ANIMATION_EVENT
780+
* @fires Phaser.Animations.Events#ANIMATION_RESTART
781+
* @fires Phaser.Animations.Events#SPRITE_ANIMATION_RESTART
782+
* @fires Phaser.Animations.Events#SPRITE_ANIMATION_KEY_RESTART
783783
* @since 3.0.0
784784
*
785785
* @param {boolean} [includeDelay=false] - Whether to include the delay value of the animation when restarting.
@@ -816,9 +816,9 @@ var Animation = new Class({
816816

817817
/**
818818
* Immediately stops the current animation from playing and dispatches the `animationcomplete` event.
819-
*
819+
*
820820
* If no animation is set, no event will be dispatched.
821-
*
821+
*
822822
* If there is another animation queued (via the `chain` method) then it will start playing immediately.
823823
*
824824
* @method Phaser.GameObjects.Components.Animation#stop
@@ -842,7 +842,7 @@ var Animation = new Class({
842842
anim.emit(Events.ANIMATION_COMPLETE, anim, frame, gameObject);
843843

844844
gameObject.emit(Events.SPRITE_ANIMATION_KEY_COMPLETE + anim.key, anim, frame, gameObject);
845-
845+
846846
gameObject.emit(Events.SPRITE_ANIMATION_COMPLETE, anim, frame, gameObject);
847847
}
848848

@@ -1039,8 +1039,8 @@ var Animation = new Class({
10391039
* Internal frame change handler.
10401040
*
10411041
* @method Phaser.GameObjects.Components.Animation#updateFrame
1042-
* @fires Phaser.Animations.Events#SPRITE_ANIMATION_UPDATE_EVENT
1043-
* @fires Phaser.Animations.Events#SPRITE_ANIMATION_KEY_UPDATE_EVENT
1042+
* @fires Phaser.Animations.Events#SPRITE_ANIMATION_UPDATE
1043+
* @fires Phaser.Animations.Events#SPRITE_ANIMATION_KEY_UPDATE
10441044
* @private
10451045
* @since 3.0.0
10461046
*
@@ -1073,7 +1073,7 @@ var Animation = new Class({
10731073
/**
10741074
* Advances the animation to the next frame, regardless of the time or animation state.
10751075
* If the animation is set to repeat, or yoyo, this will still take effect.
1076-
*
1076+
*
10771077
* Calling this does not change the direction of the animation. I.e. if it was currently
10781078
* playing in reverse, calling this method doesn't then change the direction to forwards.
10791079
*
@@ -1095,7 +1095,7 @@ var Animation = new Class({
10951095
/**
10961096
* Advances the animation to the previous frame, regardless of the time or animation state.
10971097
* If the animation is set to repeat, or yoyo, this will still take effect.
1098-
*
1098+
*
10991099
* Calling this does not change the direction of the animation. I.e. if it was currently
11001100
* playing in forwards, calling this method doesn't then change the direction to backwards.
11011101
*

src/loader/LoaderPlugin.js

Lines changed: 25 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -151,9 +151,9 @@ var LoaderPlugin = new Class({
151151

152152
/**
153153
* If you want to append a URL before the path of any asset you can set this here.
154-
*
154+
*
155155
* Useful if allowing the asset base url to be configured outside of the game code.
156-
*
156+
*
157157
* If you set this property directly then it _must_ end with a "/". Alternatively, call `setBaseURL()` and it'll do it for you.
158158
*
159159
* @name Phaser.Loader.LoaderPlugin#baseURL
@@ -232,7 +232,7 @@ var LoaderPlugin = new Class({
232232

233233
/**
234234
* Files are placed in this Set when they're added to the Loader via `addFile`.
235-
*
235+
*
236236
* They are moved to the `inflight` Set when they start loading, and assuming a successful
237237
* load, to the `queue` Set for further processing.
238238
*
@@ -246,9 +246,9 @@ var LoaderPlugin = new Class({
246246

247247
/**
248248
* Files are stored in this Set while they're in the process of being loaded.
249-
*
249+
*
250250
* Upon a successful load they are moved to the `queue` Set.
251-
*
251+
*
252252
* By the end of the load process this Set will be empty.
253253
*
254254
* @name Phaser.Loader.LoaderPlugin#inflight
@@ -259,10 +259,10 @@ var LoaderPlugin = new Class({
259259

260260
/**
261261
* Files are stored in this Set while they're being processed.
262-
*
262+
*
263263
* If the process is successful they are moved to their final destination, which could be
264264
* a Cache or the Texture Manager.
265-
*
265+
*
266266
* At the end of the load process this Set will be empty.
267267
*
268268
* @name Phaser.Loader.LoaderPlugin#queue
@@ -357,9 +357,9 @@ var LoaderPlugin = new Class({
357357

358358
/**
359359
* If you want to append a URL before the path of any asset you can set this here.
360-
*
360+
*
361361
* Useful if allowing the asset base url to be configured outside of the game code.
362-
*
362+
*
363363
* Once a base URL is set it will affect every file loaded by the Loader from that point on. It does _not_ change any
364364
* file _already_ being loaded. To reset it, call this method with no arguments.
365365
*
@@ -399,7 +399,7 @@ var LoaderPlugin = new Class({
399399
* given as it's an absolute URL.
400400
*
401401
* Please note that the path is added before the filename but *after* the baseURL (if set.)
402-
*
402+
*
403403
* Once a path is set it will then affect every file added to the Loader from that point on. It does _not_ change any
404404
* file _already_ in the load queue. To reset it, call this method with no arguments.
405405
*
@@ -426,9 +426,9 @@ var LoaderPlugin = new Class({
426426

427427
/**
428428
* An optional prefix that is automatically prepended to the start of every file key.
429-
*
429+
*
430430
* If prefix was `MENU.` and you load an image with the key 'Background' the resulting key would be `MENU.Background`.
431-
*
431+
*
432432
* Once a prefix is set it will then affect every file added to the Loader from that point on. It does _not_ change any
433433
* file _already_ in the load queue. To reset it, call this method with no arguments.
434434
*
@@ -450,9 +450,9 @@ var LoaderPlugin = new Class({
450450

451451
/**
452452
* Sets the Cross Origin Resource Sharing value used when loading files.
453-
*
453+
*
454454
* Files can override this value on a per-file basis by specifying an alternative `crossOrigin` value in their file config.
455-
*
455+
*
456456
* Once CORs is set it will then affect every file loaded by the Loader from that point on, as long as they don't have
457457
* their own CORs setting. To reset it, call this method with no arguments.
458458
*
@@ -586,7 +586,7 @@ var LoaderPlugin = new Class({
586586
* @method Phaser.Loader.LoaderPlugin#addPack
587587
* @since 3.7.0
588588
*
589-
* @param {any} data - The Pack File data to be parsed and each entry of it to added to the load queue.
589+
* @param {any} pack - The Pack File data to be parsed and each entry of it to added to the load queue.
590590
* @param {string} [packKey] - An optional key to use from the pack file data.
591591
*
592592
* @return {boolean} `true` if any files were added to the queue, otherwise `false`.
@@ -609,6 +609,11 @@ var LoaderPlugin = new Class({
609609
// Here we go ...
610610
for (var key in pack)
611611
{
612+
if (!Object.prototype.hasOwnProperty.call(pack, key))
613+
{
614+
continue;
615+
}
616+
612617
var config = pack[key];
613618

614619
// Any meta data to process?
@@ -753,10 +758,10 @@ var LoaderPlugin = new Class({
753758

754759
/**
755760
* An internal method called by the Loader.
756-
*
761+
*
757762
* It will check to see if there are any more files in the pending list that need loading, and if so it will move
758763
* them from the list Set into the inflight Set, set their CORs flag and start them loading.
759-
*
764+
*
760765
* It will carrying on doing this for each file in the pending list until it runs out, or hits the max allowed parallel downloads.
761766
*
762767
* @method Phaser.Loader.LoaderPlugin#checkLoadQueue
@@ -793,7 +798,7 @@ var LoaderPlugin = new Class({
793798

794799
/**
795800
* An internal method called automatically by the XHRLoader belong to a File.
796-
*
801+
*
797802
* This method will remove the given file from the inflight Set and update the load progress.
798803
* If the file was successful its `onProcess` method is called, otherwise it is added to the delete queue.
799804
*
@@ -933,7 +938,7 @@ var LoaderPlugin = new Class({
933938
*
934939
* @method Phaser.Loader.LoaderPlugin#flagForRemoval
935940
* @since 3.7.0
936-
*
941+
*
937942
* @param {Phaser.Loader.File} file - The File to be queued for deletion when the Loader completes.
938943
*/
939944
flagForRemoval: function (file)
@@ -961,7 +966,7 @@ var LoaderPlugin = new Class({
961966

962967
/**
963968
* Causes the browser to save the given data as a file to its default Downloads folder.
964-
*
969+
*
965970
* Creates a DOM level anchor link, assigns it as being a `download` anchor, sets the href
966971
* to be an ObjectURL based on the given data, and then invokes a click event.
967972
*

src/loader/filetypes/AnimationJSONFile.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ var LoaderEvents = require('../events');
1414
* A single Animation JSON File suitable for loading by the Loader.
1515
*
1616
* These are created when you use the Phaser.Loader.LoaderPlugin#animation method and are not typically created directly.
17-
*
17+
*
1818
* For documentation about what all the arguments and configuration options mean please see Phaser.Loader.LoaderPlugin#animation.
1919
*
2020
* @class AnimationJSONFile
@@ -80,7 +80,7 @@ var AnimationJSONFile = new Class({
8080
* Adds an Animation JSON Data file, or array of Animation JSON files, to the current load queue.
8181
*
8282
* You can call this method from within your Scene's `preload`, along with any other files you wish to load:
83-
*
83+
*
8484
* ```javascript
8585
* function preload ()
8686
* {
@@ -95,17 +95,17 @@ var AnimationJSONFile = new Class({
9595
* The typical flow for a Phaser Scene is that you load assets in the Scene's `preload` method and then when the
9696
* Scene's `create` method is called you are guaranteed that all of those assets are ready for use and have been
9797
* loaded.
98-
*
98+
*
9999
* If you call this from outside of `preload` then you are responsible for starting the Loader afterwards and monitoring
100100
* its events to know when it's safe to use the asset. Please see the Phaser.Loader.LoaderPlugin class for more details.
101-
*
101+
*
102102
* The key must be a unique String. It is used to add the file to the global JSON Cache upon a successful load.
103103
* The key should be unique both in terms of files being loaded and files already present in the JSON Cache.
104104
* Loading a file using a key that is already taken will result in a warning. If you wish to replace an existing file
105105
* then remove it from the JSON Cache first, before loading a new one.
106106
*
107107
* Instead of passing arguments you can pass a configuration object, such as:
108-
*
108+
*
109109
* ```javascript
110110
* this.load.animation({
111111
* key: 'baddieAnims',
@@ -122,9 +122,9 @@ var AnimationJSONFile = new Class({
122122
*
123123
* Once the animation data has been parsed you will be able to play animations using that data.
124124
* Please see the Animation Manager `fromJSON` method for more details about the format and playback.
125-
*
125+
*
126126
* You can also access the raw animation data from its Cache using its key:
127-
*
127+
*
128128
* ```javascript
129129
* this.load.animation('baddieAnims', 'files/BaddieAnims.json');
130130
* // and later in your game ...
@@ -143,7 +143,7 @@ var AnimationJSONFile = new Class({
143143
*
144144
* You can also optionally provide a `dataKey` to use. This allows you to extract only a part of the JSON and store it in the Cache,
145145
* rather than the whole file. For example, if your JSON data had a structure like this:
146-
*
146+
*
147147
* ```json
148148
* {
149149
* "level1": {
@@ -163,7 +163,7 @@ var AnimationJSONFile = new Class({
163163
* It is available in the default build but can be excluded from custom builds.
164164
*
165165
* @method Phaser.Loader.LoaderPlugin#animation
166-
* @fires Phaser.Loader.LoaderPlugin#addFileEvent
166+
* @fires Phaser.Loader.LoaderPlugin#ADD
167167
* @since 3.0.0
168168
*
169169
* @param {(string|Phaser.Types.Loader.FileTypes.JSONFileConfig|Phaser.Types.Loader.FileTypes.JSONFileConfig[])} key - The key to use for this file, or a file configuration object, or array of them.

0 commit comments

Comments
 (0)