Skip to content

Instantly share code, notes, and snippets.

@TrevorBasinger
Created May 5, 2015 18:56
Show Gist options
  • Save TrevorBasinger/4fad741562a6b240794a to your computer and use it in GitHub Desktop.
Save TrevorBasinger/4fad741562a6b240794a to your computer and use it in GitHub Desktop.
<!doctype html>
<html>
<head></head>
<body>
<h1>Hello World</h1>
<input id="unit" placeholder="Please enter unit number" />
<button id="join">JOIN</button>
<button id="leave">LEAVE</button>
<script src="/socket.io/socket.io.js"></script>
<script src="/js/highcharts.js"></script>
<script src="/js/mithril.js"></script>
<script>
window.onload = function () {
var joinBtn = document.getElementById ('join'),
leaveBtn = document.getElementById ('leave'),
unitInput = document.getElementById ('unit'),
socket = io ('http://localhost:9999');
joinBtn.onclick = function () { socket.emit ('join', unitInput.value); };
leaveBtn.onclick = function () { socket.emit ('leave', unitInput.value); };
socket.on ('message', function (msg) { console.log (msg); });
var unit = {};
unit.Unit = function (data) {
this.values = data.values;
this.name = data.unit;
};
unit.addValues = function (data) {
this.values.push (data.values);
};
var chartComponent = {
controller: function () {},
view: function () {},
};
};
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment