зеркало из https://github.com/microsoft/jacdac-ts.git
cleanup html
This commit is contained in:
Родитель
29e0739249
Коммит
0da2a2de39
|
@ -33,17 +33,8 @@
|
|||
|
||||
<script src="/dist/jacdac.umd.js"></script>
|
||||
<script>
|
||||
const logDiv = document.getElementById("log");
|
||||
const devicesDiv = document.getElementById("devices");
|
||||
|
||||
function log(msg) {
|
||||
const line = document.createElement("div");
|
||||
line.innerText = "" + msg;
|
||||
logDiv.insertBefore(line, logDiv.firstElementChild);
|
||||
if (logDiv.childElementCount > 100)
|
||||
logDiv.lastElementChild.remove();
|
||||
}
|
||||
|
||||
async function sniff() {
|
||||
log('starting')
|
||||
let bus;
|
||||
|
@ -53,8 +44,7 @@
|
|||
bus.on('deviceconnect', d => {
|
||||
devicesDiv.innerText = bus.devices().map(d => d.toString()).join(', ')
|
||||
});
|
||||
bus.on('packetreceive', pkt => {
|
||||
|
||||
bus.on('packetreceive', pkt => {
|
||||
const decoded = jacdac.decodePacketData(pkt);
|
||||
console.debug(jacdac.printPacket(pkt))
|
||||
if (decoded)
|
||||
|
@ -69,6 +59,15 @@
|
|||
|
||||
const connect = document.getElementById("connect");
|
||||
connect.onclick = sniff;
|
||||
|
||||
function log(msg) {
|
||||
const logDiv = document.getElementById("log");
|
||||
const line = document.createElement("div");
|
||||
line.innerText = "" + msg;
|
||||
logDiv.insertBefore(line, logDiv.firstElementChild);
|
||||
if (logDiv.childElementCount > 100)
|
||||
logDiv.lastElementChild.remove();
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
|
||||
|
|
|
@ -27,16 +27,6 @@
|
|||
|
||||
<script src="/dist/jacdac.umd.js"></script>
|
||||
<script>
|
||||
|
||||
function log(msg) {
|
||||
const logDiv = document.getElementById("log");
|
||||
const line = document.createElement("div");
|
||||
line.innerText = "" + msg;
|
||||
logDiv.insertBefore(line, logDiv.firstElementChild);
|
||||
if (logDiv.childElementCount > 100)
|
||||
logDiv.lastElementChild.remove();
|
||||
}
|
||||
|
||||
async function sniff() {
|
||||
log('starting')
|
||||
let bus;
|
||||
|
@ -52,6 +42,15 @@
|
|||
|
||||
const connect = document.getElementById("connect");
|
||||
connect.onclick = sniff;
|
||||
|
||||
function log(msg) {
|
||||
const logDiv = document.getElementById("log");
|
||||
const line = document.createElement("div");
|
||||
line.innerText = "" + msg;
|
||||
logDiv.insertBefore(line, logDiv.firstElementChild);
|
||||
if (logDiv.childElementCount > 100)
|
||||
logDiv.lastElementChild.remove();
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
|
||||
|
|
|
@ -33,17 +33,7 @@
|
|||
|
||||
<script src="/dist/jacdac.umd.js"></script>
|
||||
<script>
|
||||
const logDiv = document.getElementById("log");
|
||||
const devicesDiv = document.getElementById("devices");
|
||||
|
||||
function log(msg) {
|
||||
const line = document.createElement("div");
|
||||
line.innerText = "" + msg;
|
||||
logDiv.insertBefore(line, logDiv.firstElementChild);
|
||||
if (logDiv.childElementCount > 100)
|
||||
logDiv.lastElementChild.remove();
|
||||
}
|
||||
|
||||
async function sniff() {
|
||||
log('starting')
|
||||
let bus;
|
||||
|
@ -75,6 +65,14 @@
|
|||
|
||||
const connect = document.getElementById("connect");
|
||||
connect.onclick = sniff;
|
||||
function log(msg) {
|
||||
const logDiv = document.getElementById("log");
|
||||
const line = document.createElement("div");
|
||||
line.innerText = "" + msg;
|
||||
logDiv.insertBefore(line, logDiv.firstElementChild);
|
||||
if (logDiv.childElementCount > 100)
|
||||
logDiv.lastElementChild.remove();
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче