Last active
February 11, 2016 03:35
-
-
Save fixermark/fa672d398e57e0347c5f to your computer and use it in GitHub Desktop.
[wearscript] sample program
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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; color:white; position:relative; display:flex; align-items: center; justify-content: center" bgcolor="#000"> | |
<div id="hello" | |
style="font-size: 9em">awaiting ping</div> | |
<script> | |
function server() { | |
WS.sound('SUCCESS'); | |
WS.log(document.getElementById('hello').innerHTML); | |
WS.say("boop"); | |
WS.subscribe('ping', function(chan, counter) { | |
document.getElementById('hello').innerHTML = counter; | |
}); | |
setTimeout(function() { | |
WS.publish('ping', 1); | |
}, 3000); | |
} | |
function main() { | |
if (WS.scriptVersion(1)) return; | |
//server(); | |
WS.serverConnect('{{WSUrl}}', server); | |
} | |
window.onload = main; | |
</script> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{"name":"Example"} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment