mirror of
https://github.com/Eaglercraft-TeaVM-Fork/eagler-teavm.git
synced 2024-12-23 00:24:11 -08:00
236700ea58
Fix #920
20 lines
696 B
JavaScript
20 lines
696 B
JavaScript
let $rt_stdoutBuffer = "";
|
|
function $rt_putStdoutCustom(msg) {
|
|
let index = 0;
|
|
while (true) {
|
|
let next = msg.indexOf('\n', index);
|
|
if (next < 0) {
|
|
break;
|
|
}
|
|
let line = $rt_stdoutBuffer + msg.substring(index, next);
|
|
let lineElem = document.createElement("div");
|
|
let stdoutElem = document.getElementById("stdout");
|
|
lineElem.appendChild(document.createTextNode(line));
|
|
stdoutElem.appendChild(lineElem);
|
|
stdoutElem.scrollTop = stdoutElem.scrollHeight;
|
|
$rt_stdoutBuffer = "";
|
|
index = next + 1;
|
|
}
|
|
$rt_stdoutBuffer += msg.substring(index);
|
|
}
|
|
this.$rt_putStdoutCustom = $rt_putStdoutCustom; |