66
77var Class = require ( '../utils/Class' ) ;
88var EventEmitter = require ( 'eventemitter3' ) ;
9+ var Events = require ( './events' ) ;
910var TweenBuilder = require ( './builders/TweenBuilder' ) ;
1011var TWEEN_CONST = require ( './tween/const' ) ;
1112
@@ -567,6 +568,7 @@ var Timeline = new Class({
567568 * Starts playing the timeline.
568569 *
569570 * @method Phaser.Tweens.Timeline#play
571+ * @fires Phaser.Tweens.Events#TIMELINE_START
570572 * @since 3.0.0
571573 */
572574 play : function ( )
@@ -598,13 +600,15 @@ var Timeline = new Class({
598600 onStart . func . apply ( onStart . scope , onStart . params ) ;
599601 }
600602
601- this . emit ( 'start' , this ) ;
603+ this . emit ( Events . TIMELINE_START , this ) ;
602604 } ,
603605
604606 /**
605607 * [description]
606608 *
607609 * @method Phaser.Tweens.Timeline#nextState
610+ * @fires Phaser.Tweens.Events#TIMELINE_COMPLETE
611+ * @fires Phaser.Tweens.Events#TIMELINE_LOOP
608612 * @since 3.0.0
609613 */
610614 nextState : function ( )
@@ -627,7 +631,7 @@ var Timeline = new Class({
627631 onLoop . func . apply ( onLoop . scope , onLoop . params ) ;
628632 }
629633
630- this . emit ( 'loop' , this , this . loopCounter ) ;
634+ this . emit ( Events . TIMELINE_LOOP , this , this . loopCounter ) ;
631635
632636 this . resetTweens ( true ) ;
633637
@@ -655,7 +659,7 @@ var Timeline = new Class({
655659 onComplete . func . apply ( onComplete . scope , onComplete . params ) ;
656660 }
657661
658- this . emit ( 'complete' , this ) ;
662+ this . emit ( Events . TIMELINE_COMPLETE , this ) ;
659663
660664 this . state = TWEEN_CONST . PENDING_REMOVE ;
661665 }
@@ -666,6 +670,8 @@ var Timeline = new Class({
666670 * Otherwise, returns false.
667671 *
668672 * @method Phaser.Tweens.Timeline#update
673+ * @fires Phaser.Tweens.Events#TIMELINE_COMPLETE
674+ * @fires Phaser.Tweens.Events#TIMELINE_UPDATE
669675 * @since 3.0.0
670676 *
671677 * @param {number } timestamp - [description]
@@ -718,7 +724,7 @@ var Timeline = new Class({
718724 onUpdate . func . apply ( onUpdate . scope , onUpdate . params ) ;
719725 }
720726
721- this . emit ( 'update' , this ) ;
727+ this . emit ( Events . TIMELINE_UPDATE , this ) ;
722728
723729 // Anything still running? If not, we're done
724730 if ( stillRunning === 0 )
@@ -752,7 +758,7 @@ var Timeline = new Class({
752758 onComplete . func . apply ( onComplete . scope , onComplete . params ) ;
753759 }
754760
755- this . emit ( 'complete' , this ) ;
761+ this . emit ( Events . TIMELINE_COMPLETE , this ) ;
756762
757763 this . state = TWEEN_CONST . PENDING_REMOVE ;
758764 }
@@ -778,6 +784,7 @@ var Timeline = new Class({
778784 * Pauses the timeline, retaining its internal state.
779785 *
780786 * @method Phaser.Tweens.Timeline#pause
787+ * @fires Phaser.Tweens.Events#TIMELINE_PAUSE
781788 * @since 3.0.0
782789 *
783790 * @return {Phaser.Tweens.Timeline } This Timeline object.
@@ -795,7 +802,7 @@ var Timeline = new Class({
795802
796803 this . state = TWEEN_CONST . PAUSED ;
797804
798- this . emit ( 'pause' , this ) ;
805+ this . emit ( Events . TIMELINE_PAUSE , this ) ;
799806
800807 return this ;
801808 } ,
@@ -804,6 +811,7 @@ var Timeline = new Class({
804811 * Resumes the timeline from where it was when it was paused.
805812 *
806813 * @method Phaser.Tweens.Timeline#resume
814+ * @fires Phaser.Tweens.Events#TIMELINE_RESUME
807815 * @since 3.0.0
808816 *
809817 * @return {Phaser.Tweens.Timeline } This Timeline object.
@@ -817,7 +825,7 @@ var Timeline = new Class({
817825 this . state = this . _pausedState ;
818826 }
819827
820- this . emit ( 'resume' , this ) ;
828+ this . emit ( Events . TIMELINE_RESUME , this ) ;
821829
822830 return this ;
823831 } ,
0 commit comments