Skip to content

Commit d68d991

Browse files
committed
update the local landing page
1 parent 3801b5c commit d68d991

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

docs/examples/webusb-serial/application.js

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,17 @@
1717

1818
let currentReceiverLine;
1919

20-
function appendLine(linesId, text) {
20+
function appendLines(linesId, text) {
21+
const lines = text.split('\r');
2122
if (currentReceiverLine) {
22-
currentReceiverLine.innerHTML = currentReceiverLine.innerHTML + text;
23+
currentReceiverLine.innerHTML = currentReceiverLine.innerHTML + lines[0];
24+
for (let i = 1; i < lines.length; i++) {
25+
currentReceiverLine = addLine(linesId, lines[i]);
26+
}
2327
} else {
24-
currentReceiverLine = addLine(linesId, text);
28+
for (let i = 0; i < lines.length; i++) {
29+
currentReceiverLine = addLine(linesId, lines[i]);
30+
}
2531
}
2632
}
2733

@@ -36,7 +42,7 @@
3642
if (data.getInt8() === 13) {
3743
currentReceiverLine = null;
3844
} else {
39-
appendLine('receiver_lines', textDecoder.decode(data));
45+
appendLines('receiver_lines', textDecoder.decode(data));
4046
}
4147
};
4248
port.onReceiveError = error => {

docs/examples/webusb-serial/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,4 @@ <h1>TinyUSB - WebUSB Serial Example</h1>
3030
</div>
3131
</div>
3232
</body>
33-
</html>
33+
</html>

0 commit comments

Comments
 (0)