Skip to content

Commit d0e1320

Browse files
committed
Add generic types and fix types on Input and Structs
1 parent e9e16a7 commit d0e1320

9 files changed

Lines changed: 146 additions & 30 deletions

File tree

src/input/gamepad/Gamepad.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ var Gamepad = new Class({
8787
* [description]
8888
*
8989
* @name Phaser.Input.Gamepad.Gamepad#buttons
90-
* @type {array}
90+
* @type {Phaser.Input.Gamepad.Button[]}
9191
* @default []
9292
* @since 3.0.0
9393
*/
@@ -97,7 +97,7 @@ var Gamepad = new Class({
9797
* [description]
9898
*
9999
* @name Phaser.Input.Gamepad.Gamepad#axes
100-
* @type {array}
100+
* @type {Phaser.Input.Gamepad.Axis[]}
101101
* @default []
102102
* @since 3.0.0
103103
*/

src/input/gamepad/GamepadManager.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,12 @@ var Gamepad = require('./Gamepad');
1919
* @property {number} index - [description]
2020
*/
2121

22+
/**
23+
* @callback GamepadHandler
24+
*
25+
* @property {GamepadEvent} event - [description]
26+
*/
27+
2228
/**
2329
* @classdesc
2430
* [description]
@@ -77,7 +83,7 @@ var GamepadManager = new Class({
7783
* [description]
7884
*
7985
* @name Phaser.Input.Gamepad.GamepadManager#handler
80-
* @type {?function}
86+
* @type {?GamepadHandler}
8187
* @since 3.0.0
8288
*/
8389
this.handler;

src/input/keyboard/KeyboardManager.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,12 @@ var KeyMap = require('./keys/KeyMap');
1313
var ProcessKeyDown = require('./keys/ProcessKeyDown');
1414
var ProcessKeyUp = require('./keys/ProcessKeyUp');
1515

16+
/**
17+
* @callback KeyboardHandler
18+
*
19+
* @property {KeyboardEvent} event - [description]
20+
*/
21+
1622
/**
1723
* @classdesc
1824
* The Keyboard class monitors keyboard input and dispatches keyboard events.
@@ -114,7 +120,7 @@ var KeyboardManager = new Class({
114120
* [description]
115121
*
116122
* @name Phaser.Input.Keyboard.KeyboardManager#handler
117-
* @type {?function}
123+
* @type {?KeyboardHandler}
118124
* @since 3.0.0
119125
*/
120126
this.handler;

src/input/mouse/MouseManager.js

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,12 @@ var Features = require('../../device/Features');
1010
// https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent
1111
// https://github.com/WICG/EventListenerOptions/blob/gh-pages/explainer.md
1212

13+
/**
14+
* @callback MouseHandler
15+
*
16+
* @property {MouseEvent} event - [description]
17+
*/
18+
1319
/**
1420
* @classdesc
1521
* [description]
@@ -69,7 +75,7 @@ var MouseManager = new Class({
6975
* [description]
7076
*
7177
* @name Phaser.Input.Mouse.MouseManager#handler
72-
* @type {null}
78+
* @type {?MouseHandler}
7379
* @since 3.0.0
7480
*/
7581
this.handler;
@@ -136,13 +142,13 @@ var MouseManager = new Class({
136142

137143
/**
138144
* If the browser supports it, you can request that the pointer be locked to the browser window.
139-
*
145+
*
140146
* This is classically known as 'FPS controls', where the pointer can't leave the browser until
141147
* the user presses an exit key.
142-
*
148+
*
143149
* If the browser successfully enters a locked state, a `POINTER_LOCK_CHANGE_EVENT` will be dispatched,
144150
* from the games Input Manager, with an `isPointerLocked` property.
145-
*
151+
*
146152
* It is important to note that pointer lock can only be enabled after an 'engagement gesture',
147153
* see: https://w3c.github.io/pointerlock/#dfn-engagement-gesture.
148154
*
@@ -165,7 +171,7 @@ var MouseManager = new Class({
165171
* @method Phaser.Input.Mouse.MouseManager#pointerLockChange
166172
* @since 3.0.0
167173
*
168-
* @param {Event} event - The native event from the browser.
174+
* @param {MouseHandler} event - The native event from the browser.
169175
*/
170176
pointerLockChange: function (event)
171177
{

src/input/touch/TouchManager.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ var TouchManager = new Class({
7575
* [description]
7676
*
7777
* @name Phaser.Input.Touch.TouchManager#handler
78-
* @type {TouchHandler}
78+
* @type {?TouchHandler}
7979
* @since 3.0.0
8080
*/
8181
this.handler;

0 commit comments

Comments
 (0)