77var Class = require ( '../utils/Class' ) ;
88var CONST = require ( './const' ) ;
99var DefaultPlugins = require ( '../plugins/DefaultPlugins' ) ;
10+ var Events = require ( './events' ) ;
1011var GetPhysicsPlugins = require ( './GetPhysicsPlugins' ) ;
1112var GetScenePlugins = require ( './GetScenePlugins' ) ;
1213var NOOP = require ( '../utils/NOOP' ) ;
@@ -301,6 +302,7 @@ var Systems = new Class({
301302 *
302303 * @method Phaser.Scenes.Systems#init
303304 * @protected
305+ * @fires Phaser.Scenes.Events#BOOT
304306 * @since 3.0.0
305307 *
306308 * @param {Phaser.Game } game - A reference to the Phaser Game instance.
@@ -323,7 +325,7 @@ var Systems = new Class({
323325
324326 pluginManager . addToScene ( this , DefaultPlugins . Global , [ DefaultPlugins . CoreScene , GetScenePlugins ( this ) , GetPhysicsPlugins ( this ) ] ) ;
325327
326- this . events . emit ( 'boot' , this ) ;
328+ this . events . emit ( Events . BOOT , this ) ;
327329
328330 this . settings . isBooted = true ;
329331 } ,
@@ -352,27 +354,31 @@ var Systems = new Class({
352354 * Frame or Set Timeout call to the main Game instance.
353355 *
354356 * @method Phaser.Scenes.Systems#step
357+ * @fires Phaser.Scenes.Events#PRE_UPDATE
358+ * @fires Phaser.Scenes.Events#_UPDATE
359+ * @fires Phaser.Scenes.Events#POST_UPDATE
355360 * @since 3.0.0
356361 *
357362 * @param {number } time - The time value from the most recent Game step. Typically a high-resolution timer value, or Date.now().
358363 * @param {number } delta - The delta value since the last frame. This is smoothed to avoid delta spikes by the TimeStep class.
359364 */
360365 step : function ( time , delta )
361366 {
362- this . events . emit ( 'preupdate' , time , delta ) ;
367+ this . events . emit ( Events . PRE_UPDATE , time , delta ) ;
363368
364- this . events . emit ( 'update' , time , delta ) ;
369+ this . events . emit ( Events . UPDATE , time , delta ) ;
365370
366371 this . sceneUpdate . call ( this . scene , time , delta ) ;
367372
368- this . events . emit ( 'postupdate' , time , delta ) ;
373+ this . events . emit ( Events . POST_UPDATE , time , delta ) ;
369374 } ,
370375
371376 /**
372377 * Called automatically by the Scene Manager.
373378 * Instructs the Scene to render itself via its Camera Manager to the renderer given.
374379 *
375380 * @method Phaser.Scenes.Systems#render
381+ * @fires Phaser.Scenes.Events#RENDER
376382 * @since 3.0.0
377383 *
378384 * @param {(Phaser.Renderer.Canvas.CanvasRenderer|Phaser.Renderer.WebGL.WebGLRenderer) } renderer - The renderer that invoked the render call.
@@ -385,7 +391,7 @@ var Systems = new Class({
385391
386392 this . cameras . render ( renderer , displayList ) ;
387393
388- this . events . emit ( 'render' , renderer ) ;
394+ this . events . emit ( Events . RENDER , renderer ) ;
389395 } ,
390396
391397 /**
@@ -415,6 +421,7 @@ var Systems = new Class({
415421 * A paused Scene still renders, it just doesn't run ANY of its update handlers or systems.
416422 *
417423 * @method Phaser.Scenes.Systems#pause
424+ * @fires Phaser.Scenes.Events#PAUSE
418425 * @since 3.0.0
419426 *
420427 * @param {object } [data] - A data object that will be passed in the 'pause' event.
@@ -429,7 +436,7 @@ var Systems = new Class({
429436
430437 this . settings . active = false ;
431438
432- this . events . emit ( 'pause' , this , data ) ;
439+ this . events . emit ( Events . PAUSE , this , data ) ;
433440 }
434441
435442 return this ;
@@ -439,6 +446,7 @@ var Systems = new Class({
439446 * Resume this Scene from a paused state.
440447 *
441448 * @method Phaser.Scenes.Systems#resume
449+ * @fires Phaser.Scenes.Events#RESUME
442450 * @since 3.0.0
443451 *
444452 * @param {object } [data] - A data object that will be passed in the 'resume' event.
@@ -453,7 +461,7 @@ var Systems = new Class({
453461
454462 this . settings . active = true ;
455463
456- this . events . emit ( 'resume' , this , data ) ;
464+ this . events . emit ( Events . RESUME , this , data ) ;
457465 }
458466
459467 return this ;
@@ -468,6 +476,7 @@ var Systems = new Class({
468476 * from other Scenes may still invoke changes within it, so be careful what is left active.
469477 *
470478 * @method Phaser.Scenes.Systems#sleep
479+ * @fires Phaser.Scenes.Events#SLEEP
471480 * @since 3.0.0
472481 *
473482 * @param {object } [data] - A data object that will be passed in the 'sleep' event.
@@ -481,7 +490,7 @@ var Systems = new Class({
481490 this . settings . active = false ;
482491 this . settings . visible = false ;
483492
484- this . events . emit ( 'sleep' , this , data ) ;
493+ this . events . emit ( Events . SLEEP , this , data ) ;
485494
486495 return this ;
487496 } ,
@@ -490,6 +499,7 @@ var Systems = new Class({
490499 * Wake-up this Scene if it was previously asleep.
491500 *
492501 * @method Phaser.Scenes.Systems#wake
502+ * @fires Phaser.Scenes.Events#WAKE
493503 * @since 3.0.0
494504 *
495505 * @param {object } [data] - A data object that will be passed in the 'wake' event.
@@ -505,7 +515,7 @@ var Systems = new Class({
505515 settings . active = true ;
506516 settings . visible = true ;
507517
508- this . events . emit ( 'wake' , this , data ) ;
518+ this . events . emit ( Events . WAKE , this , data ) ;
509519
510520 if ( settings . isTransition )
511521 {
@@ -654,6 +664,8 @@ var Systems = new Class({
654664 * Called automatically by the SceneManager.
655665 *
656666 * @method Phaser.Scenes.Systems#start
667+ * @fires Phaser.Scenes.Events#START
668+ * @fires Phaser.Scenes.Events#READY
657669 * @since 3.0.0
658670 *
659671 * @param {object } data - Optional data object that may have been passed to this Scene from another.
@@ -671,10 +683,10 @@ var Systems = new Class({
671683 this . settings . visible = true ;
672684
673685 // For plugins to listen out for
674- this . events . emit ( 'start' , this ) ;
686+ this . events . emit ( Events . START , this ) ;
675687
676688 // For user-land code to listen out for
677- this . events . emit ( 'ready' , this , data ) ;
689+ this . events . emit ( Events . READY , this , data ) ;
678690 } ,
679691
680692 /**
@@ -685,6 +697,7 @@ var Systems = new Class({
685697 * to free-up resources.
686698 *
687699 * @method Phaser.Scenes.Systems#shutdown
700+ * @fires Phaser.Scenes.Events#SHUTDOWN
688701 * @since 3.0.0
689702 *
690703 * @param {object } [data] - A data object that will be passed in the 'shutdown' event.
@@ -701,7 +714,7 @@ var Systems = new Class({
701714 this . settings . active = false ;
702715 this . settings . visible = false ;
703716
704- this . events . emit ( 'shutdown' , this , data ) ;
717+ this . events . emit ( Events . SHUTDOWN , this , data ) ;
705718 } ,
706719
707720 /**
@@ -711,6 +724,7 @@ var Systems = new Class({
711724 *
712725 * @method Phaser.Scenes.Systems#destroy
713726 * @private
727+ * @fires Phaser.Scenes.Events#DESTROY
714728 * @since 3.0.0
715729 */
716730 destroy : function ( )
@@ -720,7 +734,7 @@ var Systems = new Class({
720734 this . settings . active = false ;
721735 this . settings . visible = false ;
722736
723- this . events . emit ( 'destroy' , this ) ;
737+ this . events . emit ( Events . DESTROY , this ) ;
724738
725739 this . events . removeAllListeners ( ) ;
726740
0 commit comments