-
Notifications
You must be signed in to change notification settings - Fork 0
/
TestJs.hx
34 lines (24 loc) · 812 Bytes
/
TestJs.hx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import hsm.scxml.Types;
@:expose
class TestJs {
static var s : hsm.Scxml;
public static function main() {
haxe.Log.trace = function(msg:String, ?pos:haxe.PosInfos) {
msg = StringTools.htmlEscape(msg).split("\n").join("<br/>").split("\t").join(" ");
js.Browser.document.getElementById("haxe:trace").innerHTML += msg + "<br/>";
}
var scxmlStr = haxe.Resource.getString("scxmlStr");
trace(scxmlStr);
s = new hsm.Scxml(null, scxmlStr);
s.log = function(msg) trace(msg);
s.init(null, function() {
s.start();
});
}
public static function sendEvent( event : js.html.MouseEvent ) {
trace("\nTestJs sendEvent called..");
var scxmlEvent = new hsm.scxml.Event( event.type );
scxmlEvent.data = event.detail;
s.postEvent( scxmlEvent );
}
}