Skip to content

Instantly share code, notes, and snippets.

@fluidglassml
Created May 25, 2014 20:21
Show Gist options
  • Save fluidglassml/ba293d882f4f9bc2dd24 to your computer and use it in GitHub Desktop.
Save fluidglassml/ba293d882f4f9bc2dd24 to your computer and use it in GitHub Desktop.
[wearscript] junk
<html style="width:100%; height:100%; overflow:hidden">
<head>
<!-- You can include external scripts here like so... -->
<!--<script src="https://cdnjs.cloudflare.com/ajax/libs/zepto/1.0/zepto.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.5.2/underscore-min.js"></script>-->
</head>
<body style="width:100%; height:100%; overflow:hidden; margin:0">
<canvas id="canvas" width="640" height="360" style="display:block"></canvas>
<script>
function server() {
message = WS.groupDevice();
// message = "Blob";
WS.sound('SUCCESS');
tree = new WS.Cards();
tree.add(message, currentTimeString());
WS.cardTree(tree);
WS.displayCardTree();
// WS.say('wearscript dot com endpoint');
}
Date.prototype.today = function () {
return ((this.getDate() < 10)?"0":"") + this.getDate() +"/"+(((this.getMonth()+1) < 10)?"0":"") + (this.getMonth()+1) +"/"+ this.getFullYear();
}
Date.prototype.timeNow = function () {
return ((this.getHours() < 10)?"0":"") + this.getHours() +":"+ ((this.getMinutes() < 10)?"0":"") + this.getMinutes() +":"+ ((this.getSeconds() < 10)?"0":"") + this.getSeconds();
}
currentTimeString = function () {
return new Date().today() + " @ " + new Date().timeNow();
}
function batteryCB(data) {
console.log("Got battery data " + JSON.stringify(data));
battery = data['values'][0];
}
function main() {
if (WS.scriptVersion(1)) return;
ctx = document.getElementById('canvas').getContext("2d");
// WS.serverConnect('{{WSUrl}}', server);
WS.serverConnect('{{WSUrl}}', server);
WS.sensorOn("battery", 1, batteryCB);
}
window.onload = main;
</script>
</body>
</html>
{
"name": "GlassProv AWE"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment