mirror of
https://github.com/photonstorm/phaser
synced 2024-12-11 13:56:16 +00:00
75 lines
3.2 KiB
Text
75 lines
3.2 KiB
Text
|
JSDOC3 Work:
|
||
|
|
||
|
1) This should go at the top of every file (with the module name corrected)
|
||
|
|
||
|
/**
|
||
|
* @author Richard Davey <rich@photonstorm.com>
|
||
|
* @copyright 2013 Photon Storm Ltd.
|
||
|
* @license https://github.com/photonstorm/phaser/blob/master/license.txt MIT License
|
||
|
* @module Phaser.Animation
|
||
|
*/
|
||
|
|
||
|
2) This is the format a constructor should be:
|
||
|
|
||
|
/**
|
||
|
* The constructor description goes here. If there isn't one for you to paste in, just put TODO.
|
||
|
*
|
||
|
* @class Phaser.Animation
|
||
|
* @constructor
|
||
|
* @param {Phaser.Game} game - A reference to the currently running game.
|
||
|
* @param {Phaser.Sprite} parent - A reference to the owner of this Animation.
|
||
|
* @param {string} name - The unique name for this animation, used in playback commands.
|
||
|
* @param {Phaser.Animation.FrameData} frameData - The FrameData object that contains all frames used by this Animation.
|
||
|
* @param {(Array.<number>|Array.<string>)} frames - An array of numbers or strings indicating which frames to play in which order.
|
||
|
* @param {number} delay - The time between each frame of the animation, given in ms.
|
||
|
* @param {boolean} looped - Should this animation loop or play through once.
|
||
|
*/
|
||
|
|
||
|
You must ensure the class is correct and it has the @constructor tag.
|
||
|
It is important you include the data-type. I don't expect you to know what the data type is, so just include: {todo}
|
||
|
It is important you include the hypen after the parameter name. You will always know what the parameter name is, so it should always be included.
|
||
|
You often won't know what the parameter description is, so just put "todo", like this:
|
||
|
|
||
|
* @param {todo} name - todo.
|
||
|
|
||
|
3) Functions are nearly exactly the same as the constructor:
|
||
|
|
||
|
/**
|
||
|
* The function description goes here. If there isn't one for you to paste in, just put TODO.
|
||
|
*
|
||
|
* @method play
|
||
|
* @param {Number} [frameRate=null] The framerate to play the animation at.
|
||
|
* @return {Phaser.Animation} A reference to this Animation instance.
|
||
|
*/
|
||
|
|
||
|
You must ensure the @method tag is correct and present.
|
||
|
It is important you include the data-type. I don't expect you to know what the data type is, so just include: {todo}
|
||
|
It is important you include the hypen after the parameter name. You will always know what the parameter name is, so it should always be included.
|
||
|
You often won't know what the parameter description is, so just put "todo", like this:
|
||
|
|
||
|
* @param {todo} name - todo.
|
||
|
|
||
|
4) All properties must be marked-up:
|
||
|
|
||
|
/**
|
||
|
* @property {boolean} isFinished - The finished state of the Animation. Set to true once playback completes, false during playback.
|
||
|
* @default
|
||
|
*/
|
||
|
this.isFinished = false;
|
||
|
|
||
|
It is important you include the data-type. I don't expect you to know what the data type is, so just include: {todo}
|
||
|
It is important you include the hypen after the parameter name. You will always know what the parameter name is, so it should always be included.
|
||
|
You often won't know what the parameter description is, so just put "todo", like this:
|
||
|
|
||
|
* @property {todo} isFinished - todo.
|
||
|
|
||
|
If the property has a base value assigned to it (i.e. a number or a string) then put @default.
|
||
|
If the property starts with an underscore it must include @private. Here is an example combining the two:
|
||
|
|
||
|
/**
|
||
|
* @property {number} _frameIndex - The index of the current frame.
|
||
|
* @private
|
||
|
* @default
|
||
|
*/
|
||
|
this._frameIndex = 0;
|