Skip to content

Instantly share code, notes, and snippets.

@connerbrooks
Last active August 29, 2015 13:56
Show Gist options
  • Save connerbrooks/9335960 to your computer and use it in GitHub Desktop.
Save connerbrooks/9335960 to your computer and use it in GitHub Desktop.
Wearscript-pebble example
<html style="width:100%; height:100%; overflow:hidden">
<head>
<!--<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>
<!--currently works with a phone running WS connected to a pebble, running the Pebble Watch app from wearscript-pebble-->
function onPebbleClick(name) {
WSRAW.log('onPebbleClick: ' + name);
switch(name)
{
case 'UP':
WSRAW.say('up');
break;
case 'DOWN':
WSRAW.say('down');
break;
case 'SELECT':
WSRAW.say('select');
break;
case 'MULTI_SELECT':
WSRAW.say('multiselect');
break;
}
}
function server() {
WSRAW.log('Welcome to WearScript-Pebble');
WSRAW.say('Welcome to WearScript-Pebble');
}
function main() {
if (WSRAW.scriptVersion(1)) return;
ctx = document.getElementById('canvas').getContext("2d");
WSRAW.serverConnect('{{WSUrl}}', 'server');
}
window.onload = main;
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment