-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Leon
committed
Sep 2, 2013
1 parent
ed2ea51
commit 0aaa5fb
Showing
7 changed files
with
185 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
llvm-gcc-4.2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
function Event(data) { | ||
this.time = ko.observable(data.time); | ||
this.id = ko.observable(data.id); | ||
} | ||
|
||
function EventViewModel() { | ||
var t = this; | ||
var self = this; | ||
t.events = ko.observableArray([]); | ||
$.getJSON("/api/focus/event", function(raw) { | ||
var events = $.map(raw, function(item) { return new Event(item) }); | ||
self.events(events); | ||
console.log(events); | ||
}); | ||
var es = new EventSource('/api/stream/event'); | ||
es.onmessage = function(e) { | ||
var data = JSON.parse(e.data); | ||
console.log(data); | ||
t.events.push(data); | ||
}; | ||
} | ||
ko.applyBindings(new EventViewModel()); | ||
|
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<!doctype html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<title>Events</title> | ||
</head> | ||
<body> | ||
<table> | ||
<thead> | ||
<tr><th>First name</th><th>Last name</th></tr> | ||
</thead> | ||
<tbody data-bind="foreach: events"> | ||
<tr> | ||
<td data-bind="text: id"></td> | ||
<td data-bind="text: time"></td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
<script src="/js/jquery-2.0.0.min.js"></script> | ||
<script src="/js/knockout.js"></script> | ||
<script src="/js/app.js"></script> | ||
</body> | ||
</html> |