Skip to content

Instantly share code, notes, and snippets.

@timothyclemans
Created March 22, 2014 17:56
Show Gist options
  • Save timothyclemans/9711521 to your computer and use it in GitHub Desktop.
Save timothyclemans/9711521 to your computer and use it in GitHub Desktop.
[wearscript]
<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">
Single wink = QR<br/>
Double wink = Camera
<script>
function onGesture(name) {
WS.log(name);
if (name == 'WINK' || name == 'TAP') {
WS.qr(function (data) {WS.say(data)});
} else if (name == 'DOUBLE_BLINK' || name == 'TWO_TAP') {
WS.cameraPhoto();
}
}
function server() {
WS.log('hi');
WS.gestureCallback('onEyeGesture', 'onGesture');
WS.gestureCallback('onGesture', 'onGesture');
}
function main() {
if (WS.scriptVersion(1)) return;
WS.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