Skip to content

Commit 620bcc6

Browse files
committed
jsdoc fixes and additions
1 parent a78651a commit 620bcc6

10 files changed

Lines changed: 63 additions & 61 deletions

File tree

src/display/canvas/CanvasPool.js

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -32,18 +32,18 @@ var CanvasPool = function ()
3232
* @function Phaser.Display.Canvas.CanvasPool.create
3333
* @since 3.0.0
3434
*
35-
* @param {any} parent - [description]
36-
* @param {integer} [width=1] - [description]
37-
* @param {integer} [height=1] - [description]
38-
* @param {integer} [type] - [description]
35+
* @param {any} parent - The parent of the Canvas object.
36+
* @param {integer} [width=1] - The width of the Canvas.
37+
* @param {integer} [height=1] - The height of the Canvas.
38+
* @param {integer} [canvasType=Phaser.CANVAS] - The type of the Canvas. Either `Phaser.CANVAS` or `Phaser.WEBGL`.
3939
*
4040
* @return {HTMLCanvasElement} [description]
4141
*/
42-
var create = function (parent, width, height, type)
42+
var create = function (parent, width, height, canvasType)
4343
{
4444
if (width === undefined) { width = 1; }
4545
if (height === undefined) { height = 1; }
46-
if (type === undefined) { type = CONST.CANVAS; }
46+
if (canvasType === undefined) { canvasType = CONST.CANVAS; }
4747

4848
var canvas;
4949
var container = first(type);
@@ -53,7 +53,7 @@ var CanvasPool = function ()
5353
container = {
5454
parent: parent,
5555
canvas: document.createElement('canvas'),
56-
type: type
56+
type: canvasType
5757
};
5858

5959
pool.push(container);
@@ -70,7 +70,7 @@ var CanvasPool = function ()
7070
canvas.width = width;
7171
canvas.height = height;
7272

73-
if (_disableContextSmoothing && type === CONST.CANVAS)
73+
if (_disableContextSmoothing && canvasType === CONST.CANVAS)
7474
{
7575
Smoothing.disable(canvas.getContext('2d'));
7676
}
@@ -84,9 +84,9 @@ var CanvasPool = function ()
8484
* @function Phaser.Display.Canvas.CanvasPool.create2D
8585
* @since 3.0.0
8686
*
87-
* @param {any} parent - [description]
88-
* @param {integer} [width=1] - [description]
89-
* @param {integer} [height=1] - [description]
87+
* @param {any} parent - The parent of the Canvas object.
88+
* @param {integer} [width=1] - The width of the Canvas.
89+
* @param {integer} [height=1] - The height of the Canvas.
9090
*
9191
* @return {HTMLCanvasElement} [description]
9292
*/
@@ -101,9 +101,9 @@ var CanvasPool = function ()
101101
* @function Phaser.Display.Canvas.CanvasPool.createWebGL
102102
* @since 3.0.0
103103
*
104-
* @param {any} parent - [description]
105-
* @param {integer} [width=1] - [description]
106-
* @param {integer} [height=1] - [description]
104+
* @param {any} parent - The parent of the Canvas object.
105+
* @param {integer} [width=1] - The width of the Canvas.
106+
* @param {integer} [height=1] - The height of the Canvas.
107107
*
108108
* @return {HTMLCanvasElement} [description]
109109
*/
@@ -118,17 +118,17 @@ var CanvasPool = function ()
118118
* @function Phaser.Display.Canvas.CanvasPool.first
119119
* @since 3.0.0
120120
*
121-
* @param {integer} [type] - [description]
121+
* @param {integer} [canvasType=Phaser.CANVAS] - The type of the Canvas. Either `Phaser.CANVAS` or `Phaser.WEBGL`.
122122
*
123123
* @return {HTMLCanvasElement} [description]
124124
*/
125-
var first = function (type)
125+
var first = function (canvasType)
126126
{
127-
if (type === undefined) { type = CONST.CANVAS; }
127+
if (canvasType === undefined) { canvasType = CONST.CANVAS; }
128128

129129
pool.forEach(function (container)
130130
{
131-
if (!container.parent && container.type === type)
131+
if (!container.parent && container.type === canvasType)
132132
{
133133
return container;
134134
}

src/gameobjects/GameObjectCreator.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,11 +120,11 @@ var GameObjectCreator = new Class({
120120

121121
// Static method called directly by the Game Object creator functions
122122

123-
GameObjectCreator.register = function (type, factoryFunction)
123+
GameObjectCreator.register = function (factoryType, factoryFunction)
124124
{
125-
if (!GameObjectCreator.prototype.hasOwnProperty(type))
125+
if (!GameObjectCreator.prototype.hasOwnProperty(factoryType))
126126
{
127-
GameObjectCreator.prototype[type] = factoryFunction;
127+
GameObjectCreator.prototype[factoryType] = factoryFunction;
128128
}
129129
};
130130

src/gameobjects/GameObjectFactory.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -147,11 +147,11 @@ var GameObjectFactory = new Class({
147147

148148
// Static method called directly by the Game Object factory functions
149149

150-
GameObjectFactory.register = function (type, factoryFunction)
150+
GameObjectFactory.register = function (factoryType, factoryFunction)
151151
{
152-
if (!GameObjectFactory.prototype.hasOwnProperty(type))
152+
if (!GameObjectFactory.prototype.hasOwnProperty(factoryType))
153153
{
154-
GameObjectFactory.prototype[type] = factoryFunction;
154+
GameObjectFactory.prototype[factoryType] = factoryFunction;
155155
}
156156
};
157157

src/gameobjects/rendertexture/RenderTexture.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ var RenderTexture = new Class({
130130
* @method Phaser.GameObjects.RenderTexture#setGlobalTint
131131
* @since 3.2.0
132132
*
133-
* @param {int} tint [description]
133+
* @param {integer} tint [description]
134134
*
135135
* @return {Phaser.GameObjects.RenderTexture} [description]
136136
*/

src/gameobjects/text/static/Text.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ var Text = new Class({
179179
* [description]
180180
*
181181
* @name Phaser.GameObjects.Text#canvasTexture
182-
* @type {?[type]}
182+
* @type {HTMLCanvasElement}
183183
* @default null
184184
* @since 3.0.0
185185
*/

src/loader/filetypes/AudioFile.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -216,14 +216,15 @@ AudioFile.findAudioURL = function (game, urls)
216216
return url;
217217
}
218218

219-
var type = url.match(/\.([a-zA-Z0-9]+)($|\?)/);
220-
type = GetFastValue(urls[i], 'type', type ? type[1] : '').toLowerCase();
219+
var audioType = url.match(/\.([a-zA-Z0-9]+)($|\?)/);
221220

222-
if (game.device.audio[type])
221+
audioType = GetFastValue(urls[i], 'type', (audioType) ? audioType[1] : '').toLowerCase();
222+
223+
if (game.device.audio[audioType])
223224
{
224225
return {
225226
uri: url,
226-
type: type
227+
type: audioType
227228
};
228229
}
229230
}

src/physics/arcade/World.js

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -268,11 +268,11 @@ var World = new Class({
268268
* @since 3.0.0
269269
*
270270
* @param {Phaser.GameObjects.GameObject|Phaser.GameObjects.GameObject[]} object - [description]
271-
* @param {integer} [type] - [description]
271+
* @param {integer} [bodyType] - The type of Body to create. Either `DYNAMIC_BODY` or `STATIC_BODY`.
272272
*/
273-
enable: function (object, type)
273+
enable: function (object, bodyType)
274274
{
275-
if (type === undefined) { type = CONST.DYNAMIC_BODY; }
275+
if (bodyType === undefined) { bodyType = CONST.DYNAMIC_BODY; }
276276

277277
var i = 1;
278278

@@ -285,22 +285,22 @@ var World = new Class({
285285
if (object[i].hasOwnProperty('children'))
286286
{
287287
// If it's a Group then we do it on the children regardless
288-
this.enable(object[i].children.entries, type);
288+
this.enable(object[i].children.entries, bodyType);
289289
}
290290
else
291291
{
292-
this.enableBody(object[i], type);
292+
this.enableBody(object[i], bodyType);
293293
}
294294
}
295295
}
296296
else if (object.hasOwnProperty('children'))
297297
{
298298
// If it's a Group then we do it on the children regardless
299-
this.enable(object.children.entries, type);
299+
this.enable(object.children.entries, bodyType);
300300
}
301301
else
302302
{
303-
this.enableBody(object, type);
303+
this.enableBody(object, bodyType);
304304
}
305305
},
306306

@@ -311,21 +311,21 @@ var World = new Class({
311311
* @since 3.0.0
312312
*
313313
* @param {Phaser.GameObjects.GameObject} object - [description]
314-
* @param {integer} type - [description]
314+
* @param {integer} [bodyType] - The type of Body to create. Either `DYNAMIC_BODY` or `STATIC_BODY`.
315315
*
316316
* @return {Phaser.GameObjects.GameObject} [description]
317317
*/
318-
enableBody: function (object, type)
318+
enableBody: function (object, bodyType)
319319
{
320320
if (object.body === null)
321321
{
322-
if (type === CONST.DYNAMIC_BODY)
322+
if (bodyType === CONST.DYNAMIC_BODY)
323323
{
324324
object.body = new Body(this, object);
325325

326326
this.bodies.set(object.body);
327327
}
328-
else if (type === CONST.STATIC_BODY)
328+
else if (bodyType === CONST.STATIC_BODY)
329329
{
330330
object.body = new StaticBody(this, object);
331331

src/physics/impact/Body.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -555,7 +555,7 @@ var Body = new Class({
555555
* @method Phaser.Physics.Impact.Body#handleMovementTrace
556556
* @since 3.0.0
557557
*
558-
* @param {[type]} res - [description]
558+
* @param {number} res - [description]
559559
*
560560
* @return {boolean} [description]
561561
*/

src/polyfills/Uint32Array.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,18 @@
33
* Source: http://www.html5gamedevs.com/topic/5988-phaser-12-ie9/
44
* Cameron Foale (http://www.kibibu.com)
55
*/
6-
if (typeof window.Uint32Array !== "function" && typeof window.Uint32Array !== "object")
6+
if (typeof window.Uint32Array !== 'function' && typeof window.Uint32Array !== 'object')
77
{
8-
var CheapArray = function(type)
8+
var CheapArray = function (fakeType)
99
{
1010
var proto = new Array(); // jshint ignore:line
1111

12-
window[type] = function(arg) {
12+
window[fakeType] = function(arg) {
1313

14-
if (typeof(arg) === "number")
14+
if (typeof(arg) === 'number')
1515
{
1616
Array.call(this, arg);
17+
1718
this.length = arg;
1819

1920
for (var i = 0; i < this.length; i++)
@@ -34,8 +35,8 @@ if (typeof window.Uint32Array !== "function" && typeof window.Uint32Array !== "o
3435
}
3536
};
3637

37-
window[type].prototype = proto;
38-
window[type].constructor = window[type];
38+
window[fakeType].prototype = proto;
39+
window[fakeType].constructor = window[fakeType];
3940
};
4041

4142
CheapArray('Float32Array'); // jshint ignore:line

src/renderer/webgl/WebGLPipeline.js

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -205,10 +205,10 @@ var WebGLPipeline = new Class({
205205
* @since 3.2.0
206206
*
207207
* @param {string} name - [description]
208-
* @param {int} size - [description]
209-
* @param {int} type - [description]
208+
* @param {integer} size - [description]
209+
* @param {integer} type - [description]
210210
* @param {boolean} normalized - [description]
211-
* @param {int} offset - [description]
211+
* @param {integer} offset - [description]
212212
*
213213
* @return {Phaser.Renderer.WebGL.WebGLPipeline} [description]
214214
*/
@@ -495,7 +495,7 @@ var WebGLPipeline = new Class({
495495
* @since 3.2.0
496496
*
497497
* @param {string} name - [description]
498-
* @param {int} x - [description]
498+
* @param {integer} x - [description]
499499
*
500500
* @return {Phaser.Renderer.WebGL.WebGLPipeline} [description]
501501
*/
@@ -512,8 +512,8 @@ var WebGLPipeline = new Class({
512512
* @since 3.2.0
513513
*
514514
* @param {string} name - [description]
515-
* @param {int} x - [description]
516-
* @param {int} y - [description]
515+
* @param {integer} x - [description]
516+
* @param {integer} y - [description]
517517
*
518518
* @return {Phaser.Renderer.WebGL.WebGLPipeline} [description]
519519
*/
@@ -530,9 +530,9 @@ var WebGLPipeline = new Class({
530530
* @since 3.2.0
531531
*
532532
* @param {string} name - [description]
533-
* @param {int} x - [description]
534-
* @param {int} y - [description]
535-
* @param {int} z - [description]
533+
* @param {integer} x - [description]
534+
* @param {integer} y - [description]
535+
* @param {integer} z - [description]
536536
*
537537
* @return {Phaser.Renderer.WebGL.WebGLPipeline} [description]
538538
*/
@@ -549,10 +549,10 @@ var WebGLPipeline = new Class({
549549
* @since 3.2.0
550550
*
551551
* @param {string} name - [description]
552-
* @param {int} x - [description]
553-
* @param {int} y - [description]
554-
* @param {int} z - [description]
555-
* @param {int} w - [description]
552+
* @param {integer} x - [description]
553+
* @param {integer} y - [description]
554+
* @param {integer} z - [description]
555+
* @param {integer} w - [description]
556556
*
557557
* @return {Phaser.Renderer.WebGL.WebGLPipeline} [description]
558558
*/

0 commit comments

Comments
 (0)