Skip to content

Commit 0db663d

Browse files
committed
More typedefs
1 parent 42cb397 commit 0db663d

25 files changed

Lines changed: 146 additions & 128 deletions

src/input/InputPlugin.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ var InputPlugin = new Class({
8989
* A reference to the Scene Systems Settings.
9090
*
9191
* @name Phaser.Input.InputPlugin#settings
92-
* @type {Phaser.Scenes.Settings.Object}
92+
* @type {Phaser.Scenes.Types.SettingsObject}
9393
* @since 3.5.0
9494
*/
9595
this.settings = scene.sys.settings;

src/input/gamepad/GamepadPlugin.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ var GamepadPlugin = new Class({
7878
* A reference to the Scene Systems Settings.
7979
*
8080
* @name Phaser.Input.Gamepad.GamepadPlugin#settings
81-
* @type {Phaser.Scenes.Settings.Object}
81+
* @type {Phaser.Scenes.Types.SettingsObject}
8282
* @since 3.10.0
8383
*/
8484
this.settings = this.scene.sys.settings;

src/input/keyboard/KeyboardPlugin.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ var KeyboardPlugin = new Class({
9494
* A reference to the Scene Systems Settings.
9595
*
9696
* @name Phaser.Input.Keyboard.KeyboardPlugin#settings
97-
* @type {Phaser.Scenes.Settings.Object}
97+
* @type {Phaser.Scenes.Types.SettingsObject}
9898
* @since 3.10.0
9999
*/
100100
this.settings = this.scene.sys.settings;

src/scene/Scene.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ var Systems = require('./Systems');
1616
* @constructor
1717
* @since 3.0.0
1818
*
19-
* @param {(string|Phaser.Scenes.Settings.Config)} config - Scene specific configuration settings.
19+
* @param {(string|Phaser.Scenes.Types.SettingsConfig)} config - Scene specific configuration settings.
2020
*/
2121
var Scene = new Class({
2222

src/scene/SceneManager.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@ var SceneManager = new Class({
312312
* @since 3.0.0
313313
*
314314
* @param {string} key - A unique key used to reference the Scene, i.e. `MainMenu` or `Level1`.
315-
* @param {(Phaser.Scene|Phaser.Scenes.Settings.Config|function)} sceneConfig - The config for the Scene
315+
* @param {(Phaser.Scene|Phaser.Scenes.Types.SettingsConfig|function)} sceneConfig - The config for the Scene
316316
* @param {boolean} [autoStart=false] - If `true` the Scene will be started immediately after being added.
317317
* @param {object} [data] - Optional data object. This will be set as Scene.settings.data and passed to `Scene.init`.
318318
*
@@ -706,7 +706,7 @@ var SceneManager = new Class({
706706
* @since 3.0.0
707707
*
708708
* @param {string} key - The key of the Scene.
709-
* @param {(string|Phaser.Scenes.Settings.Config)} sceneConfig - The Scene config.
709+
* @param {(string|Phaser.Scenes.Types.SettingsConfig)} sceneConfig - The Scene config.
710710
*
711711
* @return {Phaser.Scene} The created Scene.
712712
*/
@@ -784,7 +784,7 @@ var SceneManager = new Class({
784784
* @since 3.0.0
785785
*
786786
* @param {string} key - The key to check in the Scene config.
787-
* @param {(Phaser.Scene|Phaser.Scenes.Settings.Config|function)} sceneConfig - The Scene config.
787+
* @param {(Phaser.Scene|Phaser.Scenes.Types.SettingsConfig|function)} sceneConfig - The Scene config.
788788
*
789789
* @return {string} The Scene key.
790790
*/

src/scene/ScenePlugin.js

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ var ScenePlugin = new Class({
4949
* The settings of the Scene this ScenePlugin belongs to.
5050
*
5151
* @name Phaser.Scenes.ScenePlugin#settings
52-
* @type {Phaser.Scenes.Settings.Object}
52+
* @type {Phaser.Scenes.Types.SettingsObject}
5353
* @since 3.0.0
5454
*/
5555
this.settings = scene.sys.settings;
@@ -226,20 +226,6 @@ var ScenePlugin = new Class({
226226
return this;
227227
},
228228

229-
/**
230-
* @typedef {object} SceneTransitionConfig
231-
*
232-
* @property {string} target - The Scene key to transition to.
233-
* @property {integer} [duration=1000] - The duration, in ms, for the transition to last.
234-
* @property {boolean} [sleep=false] - Will the Scene responsible for the transition be sent to sleep on completion (`true`), or stopped? (`false`)
235-
* @property {boolean} [allowInput=false] - Will the Scenes Input system be able to process events while it is transitioning in or out?
236-
* @property {boolean} [moveAbove] - Move the target Scene to be above this one before the transition starts.
237-
* @property {boolean} [moveBelow] - Move the target Scene to be below this one before the transition starts.
238-
* @property {function} [onUpdate] - This callback is invoked every frame for the duration of the transition.
239-
* @property {any} [onUpdateScope] - The context in which the callback is invoked.
240-
* @property {any} [data] - An object containing any data you wish to be passed to the target Scenes init / create methods.
241-
*/
242-
243229
/**
244230
* This will start a transition from the current Scene to the target Scene given.
245231
*
@@ -274,7 +260,7 @@ var ScenePlugin = new Class({
274260
* @fires Phaser.Scenes.Events#TRANSITION_OUT
275261
* @since 3.5.0
276262
*
277-
* @param {SceneTransitionConfig} config - The transition configuration object.
263+
* @param {Phaser.Scenes.Types.SceneTransitionConfig} config - The transition configuration object.
278264
*
279265
* @return {boolean} `true` is the transition was started, otherwise `false`.
280266
*/
@@ -444,7 +430,7 @@ var ScenePlugin = new Class({
444430
* @since 3.0.0
445431
*
446432
* @param {string} key - The Scene key.
447-
* @param {(Phaser.Scene|Phaser.Scenes.Settings.Config|function)} sceneConfig - The config for the Scene.
433+
* @param {(Phaser.Scene|Phaser.Scenes.Types.SettingsConfig|function)} sceneConfig - The config for the Scene.
448434
* @param {boolean} autoStart - Whether to start the Scene after it's added.
449435
* @param {object} [data] - Optional data object. This will be set as Scene.settings.data and passed to `Scene.init`.
450436
*

src/scene/Settings.js

Lines changed: 2 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -13,42 +13,6 @@ var InjectionMap = require('./InjectionMap');
1313
* @namespace Phaser.Scenes.Settings
1414
*/
1515

16-
/**
17-
* @typedef {object} Phaser.Scenes.Settings.Config
18-
*
19-
* @property {string} [key] - The unique key of this Scene. Must be unique within the entire Game instance.
20-
* @property {boolean} [active=false] - Does the Scene start as active or not? An active Scene updates each step.
21-
* @property {boolean} [visible=true] - Does the Scene start as visible or not? A visible Scene renders each step.
22-
* @property {(false|Phaser.Loader.FileTypes.PackFileConfig)} [pack=false] - An optional Loader Packfile to be loaded before the Scene begins.
23-
* @property {?(InputJSONCameraObject|InputJSONCameraObject[])} [cameras=null] - An optional Camera configuration object.
24-
* @property {Object.<string, string>} [map] - Overwrites the default injection map for a scene.
25-
* @property {Object.<string, string>} [mapAdd] - Extends the injection map for a scene.
26-
* @property {object} [physics={}] - The physics configuration object for the Scene.
27-
* @property {object} [loader={}] - The loader configuration object for the Scene.
28-
* @property {(false|*)} [plugins=false] - The plugin configuration object for the Scene.
29-
*/
30-
31-
/**
32-
* @typedef {object} Phaser.Scenes.Settings.Object
33-
*
34-
* @property {number} status - The current status of the Scene. Maps to the Scene constants.
35-
* @property {string} key - The unique key of this Scene. Unique within the entire Game instance.
36-
* @property {boolean} active - The active state of this Scene. An active Scene updates each step.
37-
* @property {boolean} visible - The visible state of this Scene. A visible Scene renders each step.
38-
* @property {boolean} isBooted - Has the Scene finished booting?
39-
* @property {boolean} isTransition - Is the Scene in a state of transition?
40-
* @property {?Phaser.Scene} transitionFrom - The Scene this Scene is transitioning from, if set.
41-
* @property {integer} transitionDuration - The duration of the transition, if set.
42-
* @property {boolean} transitionAllowInput - Is this Scene allowed to receive input during transitions?
43-
* @property {object} data - a data bundle passed to this Scene from the Scene Manager.
44-
* @property {(false|Phaser.Loader.FileTypes.PackFileConfig)} pack - The Loader Packfile to be loaded before the Scene begins.
45-
* @property {?(InputJSONCameraObject|InputJSONCameraObject[])} cameras - The Camera configuration object.
46-
* @property {Object.<string, string>} map - The Scene's Injection Map.
47-
* @property {object} physics - The physics configuration object for the Scene.
48-
* @property {object} loader - The loader configuration object for the Scene.
49-
* @property {(false|*)} plugins - The plugin configuration object for the Scene.
50-
*/
51-
5216
var Settings = {
5317

5418
/**
@@ -57,9 +21,9 @@ var Settings = {
5721
* @function Phaser.Scenes.Settings.create
5822
* @since 3.0.0
5923
*
60-
* @param {(string|Phaser.Scenes.Settings.Config)} config - The Scene configuration object used to create this Scene Settings.
24+
* @param {(string|Phaser.Scenes.Types.SettingsConfig)} config - The Scene configuration object used to create this Scene Settings.
6125
*
62-
* @return {Phaser.Scenes.Settings.Object} The Scene Settings object created as a result of the config and default settings.
26+
* @return {Phaser.Scenes.Types.SettingsObject} The Scene Settings object created as a result of the config and default settings.
6327
*/
6428
create: function (config)
6529
{

src/scene/Systems.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ var Settings = require('./Settings');
2727
* @since 3.0.0
2828
*
2929
* @param {Phaser.Scene} scene - The Scene that owns this Systems instance.
30-
* @param {(string|Phaser.Scenes.Settings.Config)} config - Scene specific configuration settings.
30+
* @param {(string|Phaser.Scenes.Types.SettingsConfig)} config - Scene specific configuration settings.
3131
*/
3232
var Systems = new Class({
3333

@@ -69,7 +69,7 @@ var Systems = new Class({
6969
* The Scene Configuration object, as passed in when creating the Scene.
7070
*
7171
* @name Phaser.Scenes.Systems#config
72-
* @type {(string|Phaser.Scenes.Settings.Config)}
72+
* @type {(string|Phaser.Scenes.Types.SettingsConfig)}
7373
* @since 3.0.0
7474
*/
7575
this.config = config;
@@ -78,7 +78,7 @@ var Systems = new Class({
7878
* The Scene Settings. This is the parsed output based on the Scene configuration.
7979
*
8080
* @name Phaser.Scenes.Systems#settings
81-
* @type {Phaser.Scenes.Settings.Object}
81+
* @type {Phaser.Scenes.Types.SettingsObject}
8282
* @since 3.0.0
8383
*/
8484
this.settings = Settings.create(config);
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/**
2+
* @typedef {object} Phaser.Scenes.Types.SceneTransitionConfig
3+
* @since 3.5.0
4+
*
5+
* @property {string} target - The Scene key to transition to.
6+
* @property {integer} [duration=1000] - The duration, in ms, for the transition to last.
7+
* @property {boolean} [sleep=false] - Will the Scene responsible for the transition be sent to sleep on completion (`true`), or stopped? (`false`)
8+
* @property {boolean} [allowInput=false] - Will the Scenes Input system be able to process events while it is transitioning in or out?
9+
* @property {boolean} [moveAbove] - Move the target Scene to be above this one before the transition starts.
10+
* @property {boolean} [moveBelow] - Move the target Scene to be below this one before the transition starts.
11+
* @property {function} [onUpdate] - This callback is invoked every frame for the duration of the transition.
12+
* @property {any} [onUpdateScope] - The context in which the callback is invoked.
13+
* @property {any} [data] - An object containing any data you wish to be passed to the target Scenes init / create methods.
14+
*/
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/**
2+
* @typedef {object} Phaser.Scenes.Types.SettingsConfig
3+
* @since 3.0.0
4+
*
5+
* @property {string} [key] - The unique key of this Scene. Must be unique within the entire Game instance.
6+
* @property {boolean} [active=false] - Does the Scene start as active or not? An active Scene updates each step.
7+
* @property {boolean} [visible=true] - Does the Scene start as visible or not? A visible Scene renders each step.
8+
* @property {(false|Phaser.Loader.FileTypes.PackFileConfig)} [pack=false] - An optional Loader Packfile to be loaded before the Scene begins.
9+
* @property {?(InputJSONCameraObject|InputJSONCameraObject[])} [cameras=null] - An optional Camera configuration object.
10+
* @property {Object.<string, string>} [map] - Overwrites the default injection map for a scene.
11+
* @property {Object.<string, string>} [mapAdd] - Extends the injection map for a scene.
12+
* @property {object} [physics={}] - The physics configuration object for the Scene.
13+
* @property {object} [loader={}] - The loader configuration object for the Scene.
14+
* @property {(false|*)} [plugins=false] - The plugin configuration object for the Scene.
15+
*/

0 commit comments

Comments
 (0)