Skip to content

Commit 439df07

Browse files
committed
Fix "object" type on GameObjects and Input
1 parent c5d4c0a commit 439df07

6 files changed

Lines changed: 86 additions & 14 deletions

File tree

src/gameobjects/group/Group.js

Lines changed: 72 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,67 @@ var Range = require('../../utils/array/Range');
1212
var Set = require('../../structs/Set');
1313
var Sprite = require('../sprite/Sprite');
1414

15+
/**
16+
* @callback GroupCallback
17+
*
18+
* @param {Phaser.GameObjects.GameObject} item - [description]
19+
*/
20+
21+
/**
22+
* @callback GroupMultipleCreateCallback
23+
*
24+
* @param {Phaser.GameObjects.GameObject[]} items - [description]
25+
*/
26+
27+
/**
28+
* @typedef {object} GroupConfig
29+
*
30+
* @property {object} [classType=Sprite] - [description]
31+
* @property {boolean} [active=true] - [description]
32+
* @property {number} [maxSize=-1] - [description]
33+
* @property {?string} [defaultKey=null] - [description]
34+
* @property {?(string|integer)} [defaultFrame=null] - [description]
35+
* @property {boolean} [runChildUpdate=false] - [description]
36+
* @property {?GroupCallback} [createCallback=null] - [description]
37+
* @property {?GroupCallback} [removeCallback=null] - [description]
38+
* @property {?GroupMultipleCreateCallback} [createMultipleCallback=null] - [description]
39+
*/
40+
41+
/**
42+
* @typedef {object} GroupCreateConfig
43+
*
44+
* @property {object} [classType] - [description]
45+
* @property {string} [key] - [description]
46+
* @property {?(string|integer)} [frame=null] - [description]
47+
* @property {boolean} [visible=true] - [description]
48+
* @property {boolean} [active=true] - [description]
49+
* @property {number} [repeat=0] - [description]
50+
* @property {boolean} [randomKey=false] - [description]
51+
* @property {boolean} [randomFrame=false] - [description]
52+
* @property {boolean} [yoyo=false] - [description]
53+
* @property {number} [frameQuantity=1] - [description]
54+
* @property {number} [max=1] - [description]
55+
* @property {object} [setXY] - [description]
56+
* @property {number} [setXY.x=0] - [description]
57+
* @property {number} [setXY.y=0] - [description]
58+
* @property {number} [setXY.stepX=0] - [description]
59+
* @property {number} [setXY.stepY=0] - [description]
60+
* @property {object} [setRotation] - [description]
61+
* @property {number} [setRotation.value=0] - [description]
62+
* @property {number} [setRotation.step=0] - [description]
63+
* @property {object} [setScale] - [description]
64+
* @property {number} [setScale.x=0] - [description]
65+
* @property {number} [setScale.y=0] - [description]
66+
* @property {number} [setScale.stepX=0] - [description]
67+
* @property {number} [setScale.stepY=0] - [description]
68+
* @property {object} [setAlpha] - [description]
69+
* @property {number} [setAlpha.value=0] - [description]
70+
* @property {number} [setAlpha.step=0] - [description]
71+
* @property {*} [hitArea] - [description]
72+
* @property {HitAreaCallback} [hitAreaCallback] - [description]
73+
* @property {(false|GridAlignConfig)} [gridAlign=false] - [description]
74+
*/
75+
1576
/**
1677
* @classdesc
1778
* [description]
@@ -26,7 +87,7 @@ var Sprite = require('../sprite/Sprite');
2687
*
2788
* @param {Phaser.Scene} scene - [description]
2889
* @param {array} children - [description]
29-
* @param {object} config - [description]
90+
* @param {GroupConfig} config - [description]
3091
*/
3192
var Group = new Class({
3293

@@ -127,7 +188,7 @@ var Group = new Class({
127188
* [description]
128189
*
129190
* @name Phaser.GameObjects.Group#createCallback
130-
* @type {?function}
191+
* @type {?GroupCallback}
131192
* @since 3.0.0
132193
*/
133194
this.createCallback = GetFastValue(config, 'createCallback', null);
@@ -136,7 +197,7 @@ var Group = new Class({
136197
* [description]
137198
*
138199
* @name Phaser.GameObjects.Group#removeCallback
139-
* @type {?function}
200+
* @type {?GroupCallback}
140201
* @since 3.0.0
141202
*/
142203
this.removeCallback = GetFastValue(config, 'removeCallback', null);
@@ -145,7 +206,7 @@ var Group = new Class({
145206
* [description]
146207
*
147208
* @name Phaser.GameObjects.Group#createMultipleCallback
148-
* @type {?function}
209+
* @type {?GroupMultipleCreateCallback}
149210
* @since 3.0.0
150211
*/
151212
this.createMultipleCallback = GetFastValue(config, 'createMultipleCallback', null);
@@ -208,7 +269,7 @@ var Group = new Class({
208269
* @method Phaser.GameObjects.Group#createMultiple
209270
* @since 3.0.0
210271
*
211-
* @param {object} config - [description]
272+
* @param {GroupCreateConfig} config - [description]
212273
*
213274
* @return {Phaser.GameObjects.GameObject[]} [description]
214275
*/
@@ -237,7 +298,7 @@ var Group = new Class({
237298
* @method Phaser.GameObjects.Group#createFromConfig
238299
* @since 3.0.0
239300
*
240-
* @param {object} options - [description]
301+
* @param {GroupCreateConfig} options - [description]
241302
*
242303
* @return {Phaser.GameObjects.GameObject[]} [description]
243304
*/
@@ -454,6 +515,11 @@ var Group = new Class({
454515

455516
this.children.delete(child);
456517

518+
if (this.removeCallback)
519+
{
520+
this.removeCallback.call(this, child);
521+
}
522+
457523
if (removeFromScene)
458524
{
459525
this.scene.sys.displayList.remove(child);

src/input/gamepad/configs/SNES_USB_Controller.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,11 @@
77
/**
88
* Tatar SNES USB Controller Gamepad Configuration.
99
* USB Gamepad (STANDARD GAMEPAD Vendor: 0079 Product: 0011)
10-
*
10+
*
1111
* @name Phaser.Input.Gamepad.Configs.SNES_USB
1212
* @type {object}
1313
* @since 3.0.0
1414
*/
15-
1615
module.exports = {
1716

1817
UP: 12,

src/input/gamepad/configs/Sony_PlayStation_DualShock_4.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,11 @@
77
/**
88
* PlayStation DualShock 4 Gamepad Configuration.
99
* Sony PlayStation DualShock 4 (v2) wireless controller
10-
*
10+
*
1111
* @name Phaser.Input.Gamepad.Configs.DUALSHOCK_4
1212
* @type {object}
1313
* @since 3.0.0
1414
*/
15-
1615
module.exports = {
1716

1817
UP: 12,

src/input/gamepad/configs/XBox360_Controller.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,11 @@
66

77
/**
88
* XBox 360 Gamepad Configuration.
9-
*
9+
*
1010
* @name Phaser.Input.Gamepad.Configs.XBOX_360
1111
* @type {object}
1212
* @since 3.0.0
1313
*/
14-
1514
module.exports = {
1615

1716
UP: 12,

src/input/keyboard/KeyboardManager.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ var KeyboardManager = new Class({
322322
* @since 3.0.0
323323
*
324324
* @param {(string|integer[]|object[])} keys - [description]
325-
* @param {object} config - [description]
325+
* @param {KeyComboConfig} config - [description]
326326
*
327327
* @return {Phaser.Input.Keyboard.KeyCombo} [description]
328328
*/

src/input/keyboard/combo/KeyCombo.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,15 @@ var ResetKeyCombo = require('./ResetKeyCombo');
1515
* @param {KeyboardEvent} event - [description]
1616
*/
1717

18+
/**
19+
* @typedef {object} KeyComboConfig
20+
*
21+
* @property {boolean} [resetOnWrongKey=true] - [description]
22+
* @property {number} [maxKeyDelay=0] - [description]
23+
* @property {boolean} [resetOnMatch=false] - [description]
24+
* @property {boolean} [deleteOnMatch=false] - [description]
25+
*/
26+
1827
/**
1928
* @classdesc
2029
* [description]
@@ -32,7 +41,7 @@ var ResetKeyCombo = require('./ResetKeyCombo');
3241
*
3342
* @param {Phaser.Input.Keyboard.KeyboardManager} keyboardManager - [description]
3443
* @param {(string|integer[]|object[])} keys - [description]
35-
* @param {object} [config] - [description]
44+
* @param {KeyComboConfig} [config] - [description]
3645
*/
3746
var KeyCombo = new Class({
3847

0 commit comments

Comments
 (0)