-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathtest.html
55 lines (49 loc) · 1.1 KB
/
test.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
<html>
<head>
<script src="augment.min.js"></script>
<script src="promise.min.js"></script>
<script>
if (!Array.prototype.fill) {
Array.prototype.fill = function (val) {
var ary = this, i = 0, ln = ary.length;
for (; i < ln; i++) {
ary[i] = val;
}
return ary;
};
}
</script>
<script src="src/panzer.js"></script>
<script>
Flow = Panzer.create();
pkgDef = Flow.pkg('debug');
proxy = new Flow({a:{b:{c:1, d:2}}});
pkgInst = pkgDef(proxy);
tank = pkgInst.tank;
pkgDef(
['begin', 'end', 'move', 'idle', 'engage', 'release', 'switch', 'traverse'],
function (e) {
console.log('trip #' + e.trip);
}
);
tank.go(1);
pkgDef.on('begin', function tmp() {
pkgDef.off('begin', tmp);
return new Promise(function (r) {
setTimeout(function () {
r();
}, 3000);
});
});
tank.go(2).then(function (t) {
console.log('done at 2?', t);
});
console.log('index afer heading to 2', tank.index);
tank.go(0).then(function (t) {
console.log('done with 0?', t);
});
console.log('index afer heading to 0', tank.index);
</script>
</head>
<body></body>
</html>