-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
91 lines (78 loc) · 2.42 KB
/
index.html
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<link rel="stylesheet" href="css/normalize.css">
<link rel="stylesheet" href="css/skeleton.css">
<link rel="stylesheet" href="css/custom.css">
<title>Gothan State Machines tests</title>
<script src="vue.js"></script>
<script src="data.js"></script>
</head>
<body>
<div id="app" class="container">
{{ message }}
<div class="row">
<div class="six columns">
<h3>Gothan State Machines tests</h3>
</div>
<div class="six columns">
<h5>Una division de Empresas Wayne</h5>
</div>
</div>
<div class="row">
<div class="five columns">
<h2>States</h2>
<ul>
<li :class="{is_current_state:state.name==current_state}" v-for="state in states">{{ state.name }}
<span v-if="state.name==current_state">✓</span>
{{ state.name==current_state }}
</li>
</ul>
</div>
<div class="five columns">
<h2>Eventos</h2>
<ul>
<p v-for="code in events">
<button class="button-primary" v-on:click="send">{{ code }}</p>
</p>
</ul>
</div>
<div class="two columns">
<h2>BUS LOG</h2>
<ul>
<li v-for="item in bus_log">{{ item }}</li>
</ul>
</div>
</div><!-- de row -->
</div><!-- de container -->
<script>
var app = new Vue({
"el": '#app',
"data": data,
"methods": {
"send": function(evt) {
var code = evt.target.innerText;
this.handle(code);
},
"handle": function(code) {
this.bus_log.push(code);
var state = this.current_state;
if (code in this.transitions[state]) {
this.current_state = this.transitions[state][code];
if (this.current_state in this.actions) {
var new_actions = this.actions[this.current_state];
console.log('new_actions', new_actions);
for (i in new_actions) {
var code = new_actions[i];
console.log('code', code);
this.handle(code);
}
}
}
}
}
});
</script>
</body>
</html>