Skip to content

Instantly share code, notes, and snippets.

@soemarko
Created March 21, 2015 17:16
Show Gist options
  • Save soemarko/0ae85d5236eaea2e76c5 to your computer and use it in GitHub Desktop.
Save soemarko/0ae85d5236eaea2e76c5 to your computer and use it in GitHub Desktop.
Spark Debugger
<!DOCTYPE html>
<html>
<script>
var source = new EventSource('https://api.spark.io/v1/devices/[DEVICE_ID]/events/?access_token=[ACCESS_TOKEN]');
source.addEventListener('logger', function(e) {
var p = document.createElement('p');
var d = JSON.parse(e.data);
p.innerHTML = d.data;
document.body.insertBefore(p, document.body.firstChild);
}, false);
</script>
<style>
body {font-family: "Helvetica-Neue", helvetica}
</style>
<head>
</head>
<body>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment