Skip to content

Commit 954fabb

Browse files
author
hyperandroid
committed
Full refactor.
Asynchronous automata management.
1 parent d884572 commit 954fabb

File tree

10 files changed

+576
-255
lines changed

10 files changed

+576
-255
lines changed

automata.d.ts

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
declare module FSM {
2+
3+
export interface TransitionMessage {
4+
msgId : string;
5+
data? : any;
6+
}
7+
8+
export interface ConsumeCallback {
9+
(session:Session):void
10+
}
11+
12+
class Session {
13+
14+
consume( message : TransitionMessage, consumeCallback? : FSM.ConsumeCallback );
15+
addListener( sl : SessionListener );
16+
removeListener( sl : SessionListener );
17+
printStackTrace();
18+
addProperty( key:string, value:any );
19+
removeProperty( key:string );
20+
getProperty( key:string ) : any;
21+
}
22+
23+
class GuardException {
24+
25+
msg : string;
26+
toString() : string;
27+
}
28+
29+
class SessionListener {
30+
contextCreated( obj );
31+
contextDestroyed( obj );
32+
finalStateReached( obj );
33+
stateChanged( obj );
34+
customEvent( obj );
35+
guardPreCondition( obj );
36+
guardPostCondition( obj );
37+
}
38+
39+
class State {
40+
getName() : string;
41+
isFinal() : boolean;
42+
}
43+
44+
class Transition {
45+
getEvent() : string;
46+
}
47+
48+
export interface StateTransitionCallback {
49+
( session:Session, state:State, transition:Transition, message:TransitionMessage ) : void;
50+
}
51+
}
52+
53+
declare module Automata {
54+
55+
export function registerFSM( object:any );
56+
export function registerFDA( object:any );
57+
export function createSession( fda_name : string, logic:any, callback?:FSM.ConsumeCallback ) : FSM.Session;
58+
export function newGuardException( message : string ) : FSM.GuardException;
59+
export function newSessionListener( obj : any ) : FSM.SessionListener;
60+
61+
}

0 commit comments

Comments
 (0)