-
Notifications
You must be signed in to change notification settings - Fork 2
/
proto.html
71 lines (67 loc) · 2.06 KB
/
proto.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
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>9serve:/</title>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.3/angular.min.js"></script>
<style>
.test-pass { background: #339933; }
.test-fail { background: #ff9999;}
.unstyled { list-style-type: none; }
.games { float:right; background: #999;}
</style>
</head>
<body ng-app>
<h1>9serve Prototype</h1>
<div class="games">
<canvas id="catclock" width="240" height="320" ng-controller="CanvasCtrl"></canvas>
</div>
<div>We are all just prisoners here of our own device.</div>
<div ng-controller="TestResults">
<ul class="unstyled">
<li ng-repeat="result in results">
<span class="test-{{result.passfail}}">{{result.name}}</span>
</li>
</ul>
</div>
<script src="ixp.all.js"></script>
<script>
ixp.set_util(ixputils);
ixp.Service.tree=ixp.mkroot();
var s = ixp.Service;
s.tree.mkdir("/goo");
s.tree.mkdir("/cow");
function TestResults($scope){
$scope.results = [
{passfail:"pass", name:"passing test"},
{passfail:"fail", name:"failing test"}
];
$scope.results = [];
var report = function(pf, text) {
$scope.results.push({passfail: pf ? "pass" : "fail", name: text});
};
var test_read =function(){
s.answer({type:s.msgtype.Tattach, tag:0, fid:0});
s.answer({type:s.msgtype.Topen, tag:0, fid:0});
var g = s.answer({type:s.msgtype.Tread, tag:0, fid:0, offset:0, count:1024});
console.log(g);
report(g.data.name === 'goo', "find goo in tree");
g = s.answer({type:s.msgtype.Tread, tag:0, fid:0, offset:g.data.length, count:1024});
console.log(g);
if (g.type === s.msgtype.Rread) {
report(g.data.name === 'cow', "find cow in tree");
} else {
report(false, "cow: "+g.ename);
}
};
test_read();
}
</script>
<script src="dist/drawchart.js"></script>
<script>
cv=s.tree.mkfile("/canvas", undefined, function(f,p){return("splat")}, function(o,d){drawchart.append(d);return Math.min(8, d.length)}, undefined);
// attach, walk([canvas]), open, read -> "splat"
// ... open(write), write({data:"\020\020\020"}) -> (append to canvas)
</script>
</body>
</html>