eagler-teavm-fork/samples/stdout-helper/src/main/webapp/teavm/stdout.js

14 lines
521 B
JavaScript
Raw Normal View History

2023-01-03 06:29:13 -08:00
let $rt_stdoutBuffer = "";
function $rt_putStdoutCustom(ch) {
if (ch === 0xA) {
2015-03-08 04:13:25 -07:00
var lineElem = document.createElement("div");
var stdoutElem = document.getElementById("stdout");
lineElem.appendChild(document.createTextNode($rt_stdoutBuffer));
stdoutElem.appendChild(lineElem);
$rt_stdoutBuffer = "";
stdoutElem.scrollTop = stdoutElem.scrollHeight;
} else {
$rt_stdoutBuffer += String.fromCharCode(ch);
}
2023-01-03 06:29:13 -08:00
}
this.$rt_putStdoutCustom = $rt_putStdoutCustom;