Great... So literally just:
// you had this var page = '<html><body><script>var ws;setTimeout(function(){'; page += 'const ws = new WebSocket("ws://" + location.host);'; page += 'ws.onmessage = function (event) { console.log("MSG:"+event.data); };'; page += 'setTimeout(function() { ws.send("Hello to Espruino!"); }, 1000);'; page += '</script><p>something</p></body></html>'; // You can do this: var page = `<html><body><script>var ws;setTimeout(function(){ const ws = new WebSocket("ws://" + location.host); ws.onmessage = function (event) { console.log("MSG:"+event.data); }; setTimeout(function() { ws.send("Hello to Espruino!"); }, 1000); </script><p>something</p></body></html>`;
It's just tidier, and especially if you're writing more HTML it'll make things a lot easier :)
@Gordon started
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
Great... So literally just:
It's just tidier, and especially if you're writing more HTML it'll make things a lot easier :)