Skip to content

Commit fd629fe

Browse files
committed
Adding callback typedefs
1 parent 4fc817c commit fd629fe

14 files changed

Lines changed: 66 additions & 66 deletions

File tree

src/actions/Call.js

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,6 @@
44
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
55
*/
66

7-
/**
8-
* @callback CallCallback
9-
*
10-
* @param {Phaser.GameObjects.GameObject} item - The Game Object to run the callback on.
11-
*/
12-
137
/**
148
* Takes an array of objects and passes each of them to the given callback.
159
*
@@ -19,7 +13,7 @@
1913
* @generic {Phaser.GameObjects.GameObject[]} G - [items,$return]
2014
*
2115
* @param {(array|Phaser.GameObjects.GameObject[])} items - The array of items to be updated by this action.
22-
* @param {CallCallback} callback - The callback to be invoked. It will be passed just one argument: the item from the array.
16+
* @param {Phaser.Actions.Types.CallCallback} callback - The callback to be invoked. It will be passed just one argument: the item from the array.
2317
* @param {*} context - The scope in which the callback will be invoked.
2418
*
2519
* @return {(array|Phaser.GameObjects.GameObject[])} The array of objects that was passed to this Action.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
/**
2+
* @callback Phaser.Actions.Types.CallCallback
3+
* @since 3.0.0
4+
*
5+
* @param {Phaser.GameObjects.GameObject} item - The Game Object to run the callback on.
6+
*/

src/cameras/2d/effects/Fade.js

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -153,18 +153,11 @@ var Fade = new Class({
153153
*/
154154
this._elapsed = 0;
155155

156-
/**
157-
* @callback CameraFadeCallback
158-
*
159-
* @param {Phaser.Cameras.Scene2D.Camera} camera - The camera on which the effect is running.
160-
* @param {number} progress - The progress of the effect. A value between 0 and 1.
161-
*/
162-
163156
/**
164157
* This callback is invoked every frame for the duration of the effect.
165158
*
166159
* @name Phaser.Cameras.Scene2D.Effects.Fade#_onUpdate
167-
* @type {?CameraFadeCallback}
160+
* @type {?Phaser.Cameras.Scene2D.Types.CameraFadeCallback}
168161
* @private
169162
* @default null
170163
* @since 3.5.0
@@ -196,7 +189,7 @@ var Fade = new Class({
196189
* @param {integer} [green=0] - The amount to fade the green channel towards. A value between 0 and 255.
197190
* @param {integer} [blue=0] - The amount to fade the blue channel towards. A value between 0 and 255.
198191
* @param {boolean} [force=false] - Force the effect to start immediately, even if already running.
199-
* @param {CameraFadeCallback} [callback] - This callback will be invoked every frame for the duration of the effect.
192+
* @param {Phaser.Cameras.Scene2D.Types.CameraFadeCallback} [callback] - This callback will be invoked every frame for the duration of the effect.
200193
* It is sent two arguments: A reference to the camera and a progress amount between 0 and 1 indicating how complete the effect is.
201194
* @param {any} [context] - The context in which the callback is invoked. Defaults to the Scene to which the Camera belongs.
202195
*

src/cameras/2d/effects/Flash.js

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -128,18 +128,11 @@ var Flash = new Class({
128128
*/
129129
this._elapsed = 0;
130130

131-
/**
132-
* @callback CameraFlashCallback
133-
*
134-
* @param {Phaser.Cameras.Scene2D.Camera} camera - The camera on which the effect is running.
135-
* @param {number} progress - The progress of the effect. A value between 0 and 1.
136-
*/
137-
138131
/**
139132
* This callback is invoked every frame for the duration of the effect.
140133
*
141134
* @name Phaser.Cameras.Scene2D.Effects.Flash#_onUpdate
142-
* @type {?CameraFlashCallback}
135+
* @type {?Phaser.Cameras.Scene2D.Types.CameraFlashCallback}
143136
* @private
144137
* @default null
145138
* @since 3.5.0
@@ -170,7 +163,7 @@ var Flash = new Class({
170163
* @param {integer} [green=255] - The amount to fade the green channel towards. A value between 0 and 255.
171164
* @param {integer} [blue=255] - The amount to fade the blue channel towards. A value between 0 and 255.
172165
* @param {boolean} [force=false] - Force the effect to start immediately, even if already running.
173-
* @param {CameraFlashCallback} [callback] - This callback will be invoked every frame for the duration of the effect.
166+
* @param {Phaser.Cameras.Scene2D.Types.CameraFlashCallback} [callback] - This callback will be invoked every frame for the duration of the effect.
174167
* It is sent two arguments: A reference to the camera and a progress amount between 0 and 1 indicating how complete the effect is.
175168
* @param {any} [context] - The context in which the callback is invoked. Defaults to the Scene to which the Camera belongs.
176169
*

src/cameras/2d/effects/Pan.js

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -123,20 +123,11 @@ var Pan = new Class({
123123
*/
124124
this._elapsed = 0;
125125

126-
/**
127-
* @callback CameraPanCallback
128-
*
129-
* @param {Phaser.Cameras.Scene2D.Camera} camera - The camera on which the effect is running.
130-
* @param {number} progress - The progress of the effect. A value between 0 and 1.
131-
* @param {number} x - The Camera's new scrollX coordinate.
132-
* @param {number} y - The Camera's new scrollY coordinate.
133-
*/
134-
135126
/**
136127
* This callback is invoked every frame for the duration of the effect.
137128
*
138129
* @name Phaser.Cameras.Scene2D.Effects.Pan#_onUpdate
139-
* @type {?CameraPanCallback}
130+
* @type {?Phaser.Cameras.Scene2D.Types.CameraPanCallback}
140131
* @private
141132
* @default null
142133
* @since 3.11.0
@@ -168,7 +159,7 @@ var Pan = new Class({
168159
* @param {integer} [duration=1000] - The duration of the effect in milliseconds.
169160
* @param {(string|function)} [ease='Linear'] - The ease to use for the pan. Can be any of the Phaser Easing constants or a custom function.
170161
* @param {boolean} [force=false] - Force the pan effect to start immediately, even if already running.
171-
* @param {CameraPanCallback} [callback] - This callback will be invoked every frame for the duration of the effect.
162+
* @param {Phaser.Cameras.Scene2D.Types.CameraPanCallback} [callback] - This callback will be invoked every frame for the duration of the effect.
172163
* It is sent four arguments: A reference to the camera, a progress amount between 0 and 1 indicating how complete the effect is,
173164
* the current camera scroll x coordinate and the current camera scroll y coordinate.
174165
* @param {any} [context] - The context in which the callback is invoked. Defaults to the Scene to which the Camera belongs.

src/cameras/2d/effects/Shake.js

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -118,18 +118,11 @@ var Shake = new Class({
118118
*/
119119
this._offsetY = 0;
120120

121-
/**
122-
* @callback CameraShakeCallback
123-
*
124-
* @param {Phaser.Cameras.Scene2D.Camera} camera - The camera on which the effect is running.
125-
* @param {number} progress - The progress of the effect. A value between 0 and 1.
126-
*/
127-
128121
/**
129122
* This callback is invoked every frame for the duration of the effect.
130123
*
131124
* @name Phaser.Cameras.Scene2D.Effects.Shake#_onUpdate
132-
* @type {?CameraShakeCallback}
125+
* @type {?Phaser.Cameras.Scene2D.Types.CameraShakeCallback}
133126
* @private
134127
* @default null
135128
* @since 3.5.0
@@ -158,7 +151,7 @@ var Shake = new Class({
158151
* @param {integer} [duration=100] - The duration of the effect in milliseconds.
159152
* @param {number} [intensity=0.05] - The intensity of the shake.
160153
* @param {boolean} [force=false] - Force the shake effect to start immediately, even if already running.
161-
* @param {CameraShakeCallback} [callback] - This callback will be invoked every frame for the duration of the effect.
154+
* @param {Phaser.Cameras.Scene2D.Types.CameraShakeCallback} [callback] - This callback will be invoked every frame for the duration of the effect.
162155
* It is sent two arguments: A reference to the camera and a progress amount between 0 and 1 indicating how complete the effect is.
163156
* @param {any} [context] - The context in which the callback is invoked. Defaults to the Scene to which the Camera belongs.
164157
*

src/cameras/2d/effects/Zoom.js

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -109,19 +109,11 @@ var Zoom = new Class({
109109
*/
110110
this._elapsed = 0;
111111

112-
/**
113-
* @callback CameraZoomCallback
114-
*
115-
* @param {Phaser.Cameras.Scene2D.Camera} camera - The camera on which the effect is running.
116-
* @param {number} progress - The progress of the effect. A value between 0 and 1.
117-
* @param {number} zoom - The Camera's new zoom value.
118-
*/
119-
120112
/**
121113
* This callback is invoked every frame for the duration of the effect.
122114
*
123115
* @name Phaser.Cameras.Scene2D.Effects.Zoom#_onUpdate
124-
* @type {?CameraZoomCallback}
116+
* @type {?Phaser.Cameras.Scene2D.Types.CameraZoomCallback}
125117
* @private
126118
* @default null
127119
* @since 3.11.0
@@ -151,7 +143,7 @@ var Zoom = new Class({
151143
* @param {integer} [duration=1000] - The duration of the effect in milliseconds.
152144
* @param {(string|function)} [ease='Linear'] - The ease to use for the Zoom. Can be any of the Phaser Easing constants or a custom function.
153145
* @param {boolean} [force=false] - Force the zoom effect to start immediately, even if already running.
154-
* @param {CameraZoomCallback} [callback] - This callback will be invoked every frame for the duration of the effect.
146+
* @param {Phaser.Cameras.Scene2D.Types.CameraZoomCallback} [callback] - This callback will be invoked every frame for the duration of the effect.
155147
* It is sent three arguments: A reference to the camera, a progress amount between 0 and 1 indicating how complete the effect is,
156148
* and the current camera zoom value.
157149
* @param {any} [context] - The context in which the callback is invoked. Defaults to the Scene to which the Camera belongs.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
/**
2+
* @callback Phaser.Cameras.Scene2D.Types.CameraFadeCallback
3+
* @since 3.5.0
4+
*
5+
* @param {Phaser.Cameras.Scene2D.Camera} camera - The camera on which the effect is running.
6+
* @param {number} progress - The progress of the effect. A value between 0 and 1.
7+
*/
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
/**
2+
* @callback Phaser.Cameras.Scene2D.Types.CameraFlashCallback
3+
* @since 3.5.0
4+
*
5+
* @param {Phaser.Cameras.Scene2D.Camera} camera - The camera on which the effect is running.
6+
* @param {number} progress - The progress of the effect. A value between 0 and 1.
7+
*/
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/**
2+
* @callback Phaser.Cameras.Scene2D.Types.CameraPanCallback
3+
* @since 3.5.0
4+
*
5+
* @param {Phaser.Cameras.Scene2D.Camera} camera - The camera on which the effect is running.
6+
* @param {number} progress - The progress of the effect. A value between 0 and 1.
7+
* @param {number} x - The Camera's new scrollX coordinate.
8+
* @param {number} y - The Camera's new scrollY coordinate.
9+
*/

0 commit comments

Comments
 (0)