Skip to content

Commit 1c311a7

Browse files
committed
Simply add type info to jsdoc of these classs.
1 parent 0adbf1d commit 1c311a7

14 files changed

Lines changed: 519 additions & 393 deletions

File tree

Phaser/FXManager.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ module Phaser {
5555
* Adds a new FX to the FXManager.
5656
* The effect must be an object with at least one of the following methods: preUpdate, postUpdate, preRender, render or postRender.
5757
* A new instance of the effect will be created and a reference to Game will be passed to the object constructor.
58+
* @param {object} effect
59+
* @return {any}
5860
*/
5961
public add(effect): any {
6062

@@ -154,6 +156,11 @@ module Phaser {
154156
/**
155157
* Pre-render is called at the start of the object render cycle, before any transforms have taken place.
156158
* It happens directly AFTER a canvas context.save has happened if added to a Camera.
159+
* @param {Camera} camera
160+
* @param {number} cameraX
161+
* @param {number} cameraY
162+
* @param {number} cameraWidth
163+
* @param {number} cameraHeight
157164
*/
158165
public preRender(camera:Camera, cameraX: number, cameraY: number, cameraWidth: number, cameraHeight: number) {
159166

@@ -172,6 +179,11 @@ module Phaser {
172179

173180
/**
174181
* render is called during the objects render cycle, right after all transforms have finished, but before any children/image data is rendered.
182+
* @param {Camera} camera
183+
* @param {number} cameraX
184+
* @param {number} cameraY
185+
* @param {number} cameraWidth
186+
* @param {number} cameraHeight
175187
*/
176188
public render(camera:Camera, cameraX: number, cameraY: number, cameraWidth: number, cameraHeight: number) {
177189

Phaser/Group.ts

Lines changed: 40 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -187,9 +187,9 @@ module Phaser {
187187
* <p>WARNING: If the group has a maxSize that has already been met,
188188
* the object will NOT be added to the group!</p>
189189
*
190-
* @param Object The object you want to add to the group.
190+
* @param {Basic} Object The object you want to add to the group.
191191
*
192-
* @return The same <code>Basic</code> object that was passed in.
192+
* @return {Basic} The same <code>Basic</code> object that was passed in.
193193
*/
194194
public add(Object: Basic) {
195195

@@ -269,9 +269,9 @@ module Phaser {
269269
* and no object class was provided, it will return null
270270
* instead of a valid object!</p>
271271
*
272-
* @param ObjectClass The class type you want to recycle (e.g. Basic, EvilRobot, etc). Do NOT "new" the class in the parameter!
272+
* @param {class} ObjectClass The class type you want to recycle (e.g. Basic, EvilRobot, etc). Do NOT "new" the class in the parameter!
273273
*
274-
* @return A reference to the object that was created. Don't forget to cast it back to the Class you want (e.g. myObject = myGroup.recycle(myObjectClass) as myObjectClass;).
274+
* @return {any} A reference to the object that was created. Don't forget to cast it back to the Class you want (e.g. myObject = myGroup.recycle(myObjectClass) as myObjectClass;).
275275
*/
276276
public recycle(ObjectClass = null) {
277277

@@ -321,10 +321,10 @@ module Phaser {
321321
/**
322322
* Removes an object from the group.
323323
*
324-
* @param object The <code>Basic</code> you want to remove.
325-
* @param splice Whether the object should be cut from the array entirely or not.
324+
* @param {Basic} object The <code>Basic</code> you want to remove.
325+
* @param {boolean} splice Whether the object should be cut from the array entirely or not.
326326
*
327-
* @return The removed object.
327+
* @return {Basic} The removed object.
328328
*/
329329
public remove(object: Basic, splice: bool = false): Basic {
330330

@@ -352,10 +352,10 @@ module Phaser {
352352
/**
353353
* Replaces an existing <code>Basic</code> with a new one.
354354
*
355-
* @param oldObject The object you want to replace.
356-
* @param newObject The new object you want to use instead.
355+
* @param {Basic} oldObject The object you want to replace.
356+
* @param {Basic} newObject The new object you want to use instead.
357357
*
358-
* @return The new object.
358+
* @return {Basic} The new object.
359359
*/
360360
public replace(oldObject: Basic, newObject: Basic): Basic {
361361

@@ -379,8 +379,8 @@ module Phaser {
379379
* <code>State.update()</code> override. To sort all existing objects after
380380
* a big explosion or bomb attack, you might call <code>myGroup.sort("exists",Group.DESCENDING)</code>.
381381
*
382-
* @param index The <code>string</code> name of the member variable you want to sort on. Default value is "y".
383-
* @param order A <code>Group</code> constant that defines the sort order. Possible values are <code>Group.ASCENDING</code> and <code>Group.DESCENDING</code>. Default value is <code>Group.ASCENDING</code>.
382+
* @param {string} index The <code>string</code> name of the member variable you want to sort on. Default value is "y".
383+
* @param {number} order A <code>Group</code> constant that defines the sort order. Possible values are <code>Group.ASCENDING</code> and <code>Group.DESCENDING</code>. Default value is <code>Group.ASCENDING</code>.
384384
*/
385385
public sort(index: string = "y", order: number = Group.ASCENDING) {
386386

@@ -393,9 +393,9 @@ module Phaser {
393393
/**
394394
* Go through and set the specified variable to the specified value on all members of the group.
395395
*
396-
* @param VariableName The string representation of the variable name you want to modify, for example "visible" or "scrollFactor".
397-
* @param Value The value you want to assign to that variable.
398-
* @param Recurse Default value is true, meaning if <code>setAll()</code> encounters a member that is a group, it will call <code>setAll()</code> on that group rather than modifying its variable.
396+
* @param {string} VariableName The string representation of the variable name you want to modify, for example "visible" or "scrollFactor".
397+
* @param {Object} Value The value you want to assign to that variable.
398+
* @param {boolean} Recurse Default value is true, meaning if <code>setAll()</code> encounters a member that is a group, it will call <code>setAll()</code> on that group rather than modifying its variable.
399399
*/
400400
public setAll(VariableName: string, Value: Object, Recurse: bool = true) {
401401

@@ -424,8 +424,8 @@ module Phaser {
424424
* Go through and call the specified function on all members of the group.
425425
* Currently only works on functions that have no required parameters.
426426
*
427-
* @param FunctionName The string representation of the function you want to call on each object, for example "kill()" or "init()".
428-
* @param Recurse Default value is true, meaning if <code>callAll()</code> encounters a member that is a group, it will call <code>callAll()</code> on that group rather than calling the group's function.
427+
* @param {string} FunctionName The string representation of the function you want to call on each object, for example "kill()" or "init()".
428+
* @param {boolean} Recurse Default value is true, meaning if <code>callAll()</code> encounters a member that is a group, it will call <code>callAll()</code> on that group rather than calling the group's function.
429429
*/
430430
public callAll(FunctionName: string, Recurse: bool = true) {
431431

@@ -450,6 +450,10 @@ module Phaser {
450450
}
451451
}
452452

453+
/**
454+
* @param {function} callback
455+
* @param {boolean} recursive
456+
*/
453457
public forEach(callback, recursive: bool = false) {
454458

455459
var basic;
@@ -474,6 +478,11 @@ module Phaser {
474478

475479
}
476480

481+
/**
482+
* @param {any} context
483+
* @param {function} callback
484+
* @param {boolean} recursive
485+
*/
477486
public forEachAlive(context, callback, recursive: bool = false) {
478487

479488
var basic;
@@ -502,9 +511,9 @@ module Phaser {
502511
* Call this function to retrieve the first object with exists == false in the group.
503512
* This is handy for recycling in general, e.g. respawning enemies.
504513
*
505-
* @param [ObjectClass] An optional parameter that lets you narrow the results to instances of this particular class.
514+
* @param {any} [ObjectClass] An optional parameter that lets you narrow the results to instances of this particular class.
506515
*
507-
* @return A <code>Basic</code> currently flagged as not existing.
516+
* @return {any} A <code>Basic</code> currently flagged as not existing.
508517
*/
509518
public getFirstAvailable(ObjectClass = null) {
510519

@@ -529,7 +538,7 @@ module Phaser {
529538
* Call this function to retrieve the first index set to 'null'.
530539
* Returns -1 if no index stores a null object.
531540
*
532-
* @return An <code>int</code> indicating the first null slot in the group.
541+
* @return {number} An <code>int</code> indicating the first null slot in the group.
533542
*/
534543
public getFirstNull(): number {
535544

@@ -557,7 +566,7 @@ module Phaser {
557566
* Call this function to retrieve the first object with exists == true in the group.
558567
* This is handy for checking if everything's wiped out, or choosing a squad leader, etc.
559568
*
560-
* @return A <code>Basic</code> currently flagged as existing.
569+
* @return {Basic} A <code>Basic</code> currently flagged as existing.
561570
*/
562571
public getFirstExtant(): Basic {
563572

@@ -582,7 +591,7 @@ module Phaser {
582591
* Call this function to retrieve the first object with dead == false in the group.
583592
* This is handy for checking if everything's wiped out, or choosing a squad leader, etc.
584593
*
585-
* @return A <code>Basic</code> currently flagged as not dead.
594+
* @return {Basic} A <code>Basic</code> currently flagged as not dead.
586595
*/
587596
public getFirstAlive(): Basic {
588597

@@ -607,7 +616,7 @@ module Phaser {
607616
* Call this function to retrieve the first object with dead == true in the group.
608617
* This is handy for checking if everything's wiped out, or choosing a squad leader, etc.
609618
*
610-
* @return A <code>Basic</code> currently flagged as dead.
619+
* @return {Basic} A <code>Basic</code> currently flagged as dead.
611620
*/
612621
public getFirstDead(): Basic {
613622

@@ -631,7 +640,7 @@ module Phaser {
631640
/**
632641
* Call this function to find out how many members of the group are not dead.
633642
*
634-
* @return The number of <code>Basic</code>s flagged as not dead. Returns -1 if group is empty.
643+
* @return {number} The number of <code>Basic</code>s flagged as not dead. Returns -1 if group is empty.
635644
*/
636645
public countLiving(): number {
637646

@@ -664,7 +673,7 @@ module Phaser {
664673
/**
665674
* Call this function to find out how many members of the group are dead.
666675
*
667-
* @return The number of <code>Basic</code>s flagged as dead. Returns -1 if group is empty.
676+
* @return {number} The number of <code>Basic</code>s flagged as dead. Returns -1 if group is empty.
668677
*/
669678
public countDead(): number {
670679

@@ -697,10 +706,10 @@ module Phaser {
697706
/**
698707
* Returns a member at random from the group.
699708
*
700-
* @param StartIndex Optional offset off the front of the array. Default value is 0, or the beginning of the array.
701-
* @param Length Optional restriction on the number of values you want to randomly select from.
709+
* @param {number} StartIndex Optional offset off the front of the array. Default value is 0, or the beginning of the array.
710+
* @param {number} Length Optional restriction on the number of values you want to randomly select from.
702711
*
703-
* @return A <code>Basic</code> from the members list.
712+
* @return {Basic} A <code>Basic</code> from the members list.
704713
*/
705714
public getRandom(StartIndex: number = 0, Length: number = 0): Basic {
706715

@@ -744,10 +753,10 @@ module Phaser {
744753
/**
745754
* Helper function for the sort process.
746755
*
747-
* @param Obj1 The first object being sorted.
748-
* @param Obj2 The second object being sorted.
756+
* @param {Basic} Obj1 The first object being sorted.
757+
* @param {Basic} Obj2 The second object being sorted.
749758
*
750-
* @return An integer value: -1 (Obj1 before Obj2), 0 (same), or 1 (Obj1 after Obj2).
759+
* @return {number} An integer value: -1 (Obj1 before Obj2), 0 (same), or 1 (Obj1 after Obj2).
751760
*/
752761
public sortHandler(Obj1: Basic, Obj2: Basic): number {
753762

0 commit comments

Comments
 (0)