@@ -51,6 +51,41 @@ declare module FSM {
5151 ( state :State , transition :Transition , message :TransitionMessage ) :void ;
5252 }
5353
54+
55+ export interface SessionFinalStateReachedEvent {
56+ session : FSM . Session ;
57+ }
58+
59+ export interface SessionContextEvent {
60+ session : FSM . Session ;
61+ context : FSM . SessionContext ;
62+ }
63+
64+ export interface SessionStateChangeEvent {
65+ session : FSM . Session ;
66+ context : FSM . SessionContext ;
67+ prevState : FSM . State ;
68+ state : FSM . State ;
69+ message : FSM . TransitionMessage ;
70+ }
71+
72+ export interface TransitionGuardEvent {
73+ session : FSM . Session ;
74+ transition : FSM . Transition ;
75+ message : FSM . TransitionMessage ;
76+ exception : string ;
77+ }
78+
79+ export interface SessionCustomEvent {
80+ session : FSM . Session ;
81+ data : any ;
82+ }
83+
84+ class SessionContext {
85+ getState ( ) : FSM . State ;
86+ printStackTrace ( ) : void ;
87+ }
88+
5489 class Session {
5590
5691 consume ( message : TransitionMessage , consumeCallback ? : FSM . ConsumeCallback ) ;
@@ -61,6 +96,7 @@ declare module FSM {
6196 removeProperty ( key :string ) ;
6297 getProperty ( key :string ) : any ;
6398 start ( callback :ConsumeCallback ) : void ;
99+ fireCustomEvent ( e :any ) : void ;
64100 }
65101
66102 class GuardException {
@@ -70,13 +106,13 @@ declare module FSM {
70106 }
71107
72108 class SessionListener {
73- contextCreated ( obj ) ;
74- contextDestroyed ( obj ) ;
75- finalStateReached ( obj ) ;
76- stateChanged ( obj ) ;
77- customEvent ( obj ) ;
78- guardPreCondition ( obj ) ;
79- guardPostCondition ( obj ) ;
109+ contextCreated ( e : SessionContextEvent ) ;
110+ contextDestroyed ( e : SessionContextEvent ) ;
111+ finalStateReached ( e : SessionFinalStateReachedEvent ) ;
112+ stateChanged ( e : SessionStateChangeEvent ) ;
113+ customEvent ( e : SessionCustomEvent ) ;
114+ guardPreCondition ( e : TransitionGuardEvent ) ;
115+ guardPostCondition ( e : TransitionGuardEvent ) ;
80116 }
81117
82118 class State {
@@ -86,6 +122,7 @@ declare module FSM {
86122
87123 class Transition {
88124 getEvent ( ) : string ;
125+ getStartState ( ) : FSM . State ;
89126 }
90127
91128 export interface StateTransitionCallback {
0 commit comments