Skip to content

Instantly share code, notes, and snippets.

@sfoster
Created July 15, 2016 21:31
Show Gist options
  • Save sfoster/da29b7f9242d955ca116586f6a5599f3 to your computer and use it in GitHub Desktop.
Save sfoster/da29b7f9242d955ca116586f6a5599f3 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>\n
<html>
<head>
<title>Example status client</title>
<style>
.led {
width: 40px;
height: 40px;
display: inline-block;
}
</style>
</head>
<body>
<script>
function pollStatus() {
// make a request to /status.json every 10s
// call updateStatus in the callback
}
function updateStatus() {
// store updated value, did the value change?
// call render if value or last-modified changed
}
function renderStatus(idx, value) {
var ctx =
// could mock some LED sequences here?
// and/or just print the status value and last-modified date for now
}
</script>
<canvas id="led0" class="led"></canvas>
<canvas id="led1" class="led"></canvas>
<canvas id="led2" class="led"></canvas>
<canvas id="led3" class="led"></canvas>
<canvas id="led4" class="led"></canvas>
</body></html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment