blob: 0fbca92e8e97bd63796508188076f6686a5c0cfa (
plain)
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
<scxml datamodel="ecmascript">
<datamodel>
<data id="stack">[]</data>
</datamodel>
<initial>
<transition target="main">
<send event="to.item1" />
<send event="to.item2" />
<send event="to.item1" />
<send event="back" />
<send event="back" />
<send event="back" />
</transition>
</initial>
<parallel id="main">
<state id="controller">
<transition event="to.item1"
target="item1.history">
<script>stack.push("item1");</script>
</transition>
<transition event="to.item2"
target="item2.history">
<script>stack.push("item2");</script>
</transition>
<transition event="back"
cond="stack[stack.length-1] === 'item1'"
target="item1">
<script>stack.pop();</script>
</transition>
<transition event="back"
cond="stack[stack.length-1] === 'item2'"
target="item2">
<script>stack.pop();</script>
</transition>
</state>
<state id="items">
<state id="item1">
<history type="deep"
id="item1.history" />
<!-- interaction would be established here -->
</state>
<state id="item2">
<history type="deep"
id="item2.history" />
<!-- interaction would be established here -->
</state>
</state>
</parallel>
</scxml>
|