Skip to content

Commit 81497c5

Browse files
authored
Merge pull request phaserjs#4623 from samme/docs/scene-methods
New types for the optional scene methods
2 parents 0ddc307 + 4ae2280 commit 81497c5

5 files changed

Lines changed: 33 additions & 34 deletions

File tree

src/scene/Scene.js

Lines changed: 2 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ var Systems = require('./Systems');
1111
* @classdesc
1212
* A base Phaser.Scene class which can be extended for your own use.
1313
*
14+
* You can also define the optional methods {@link Phaser.Types.Scenes.SceneInitCallback init()}, {@link Phaser.Types.Scenes.ScenePreloadCallback preload()}, and {@link Phaser.Types.Scenes.SceneCreateCallback create()}.
15+
*
1416
* @class Scene
1517
* @memberof Phaser
1618
* @constructor
@@ -293,36 +295,6 @@ var Scene = new Class({
293295
{
294296
}
295297

296-
/**
297-
* Can be defined on your own Scenes.
298-
* This method is called by the Scene Manager when the scene starts, before `preload()` and `create()`.
299-
*
300-
* @method Phaser.Scene#init
301-
* @since 3.0.0
302-
*
303-
* @param {object} data - Any data passed via `ScenePlugin.add()` or `ScenePlugin.start()`. Same as Scene.settings.data.
304-
*/
305-
306-
/**
307-
* Can be defined on your own Scenes. Use it to load assets.
308-
* This method is called by the Scene Manager, after `init()` and before `create()`, only if the Scene has a LoaderPlugin.
309-
* After this method completes, if the LoaderPlugin's queue isn't empty, the LoaderPlugin will start automatically.
310-
*
311-
* @method Phaser.Scene#preload
312-
* @since 3.0.0
313-
*/
314-
315-
/**
316-
* Can be defined on your own Scenes. Use it to create your game objects.
317-
* This method is called by the Scene Manager when the scene starts, after `init()` and `preload()`.
318-
* If the LoaderPlugin started after `preload()`, then this method is called only after loading is complete.
319-
*
320-
* @method Phaser.Scene#create
321-
* @since 3.0.0
322-
*
323-
* @param {object} data - Any data passed via `ScenePlugin.add()` or `ScenePlugin.start()`. Same as Scene.settings.data.
324-
*/
325-
326298
});
327299

328300
module.exports = Scene;

src/scene/typedefs/CreateSceneFromObjectConfig.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
* @typedef {object} Phaser.Types.Scenes.CreateSceneFromObjectConfig
33
* @since 3.17.0
44
*
5-
* @property {function} [init] - See {@link Phaser.Scene#init}.
6-
* @property {function} [preload] - See See {@link Phaser.Scene#preload}.
7-
* @property {function} [create] - See {@link Phaser.Scene#create}.
8-
* @property {function} [update] - See {@link Phaser.Scene#update}.
5+
* @property {Phaser.Types.Scenes.SceneInitCallback} [init] - The scene's init callback.
6+
* @property {Phaser.Types.Scenes.ScenePreloadCallback} [preload] - The scene's preload callback.
7+
* @property {Phaser.Types.Scenes.SceneCreateCallback} [create] - The scene's create callback.
8+
* @property {function} [update] - The scene's update callback. See {@link Phaser.Scene#update}.
99
* @property {any} [extend] - Any additional properties, which will be copied to the Scene after it's created (except `data` or `sys`).
1010
* @property {any} [extend.data] - Any values, which will be merged into the Scene's Data Manager store.
1111
*/
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
/**
2+
* Can be defined on your own Scenes. Use it to create your game objects.
3+
* This method is called by the Scene Manager when the scene starts, after `init()` and `preload()`.
4+
* If the LoaderPlugin started after `preload()`, then this method is called only after loading is complete.
5+
*
6+
* @callback Phaser.Types.Scenes.SceneCreateCallback
7+
* @since 3.0.0
8+
*
9+
* @param {object} data - Any data passed via `ScenePlugin.add()` or `ScenePlugin.start()`. Same as Scene.settings.data.
10+
*/
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/**
2+
* Can be defined on your own Scenes.
3+
* This method is called by the Scene Manager when the scene starts, before `preload()` and `create()`.
4+
*
5+
* @callback Phaser.Types.Scenes.SceneInitCallback
6+
* @since 3.0.0
7+
*
8+
* @param {object} data - Any data passed via `ScenePlugin.add()` or `ScenePlugin.start()`. Same as Scene.settings.data.
9+
*/
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/**
2+
* Can be defined on your own Scenes. Use it to load assets.
3+
* This method is called by the Scene Manager, after `init()` and before `create()`, only if the Scene has a LoaderPlugin.
4+
* After this method completes, if the LoaderPlugin's queue isn't empty, the LoaderPlugin will start automatically.
5+
*
6+
* @callback Phaser.Types.Scenes.ScenePreloadCallback
7+
* @since 3.0.0
8+
*/

0 commit comments

Comments
 (0)