Слияние кода завершено, страница обновится автоматически
<html>
<meta charset="utf-8">
<head>
<script type='text/javascript'>
var Module = {
postRun: [
text_changed
],
print: (function() {
return function(text) {
if (arguments.length > 1) text = Array.prototype.slice.call(arguments).join(' ');
console.log(text);
if(text != "emsc")
document.getElementById("result").innerHTML += "<br>\n" + text;
};
})(),
printErr: function(text) {
if (arguments.length > 1) text = Array.prototype.slice.call(arguments).join(' ');
if (0) { // XXX disabled for safety typeof dump == 'function') {
dump(text + '\n'); // fast, straight to the real console
} else {
console.error(text);
}
}
};
var xhr = new XMLHttpRequest();
xhr.open('GET', 'main.wasm', true);
xhr.responseType = 'arraybuffer';
xhr.overrideMimeType("application/javascript");
xhr.onload = function() {
Module.wasmBinary = xhr.response;
var script = document.createElement('script');
script.src = "main.js";
document.body.appendChild(script);
};
xhr.send(null);
var timer;
function text_changed() {
clearTimeout(timer);
input = document.getElementById("edit").value;
timer = setTimeout(function() {
document.getElementById("result").innerHTML = "";
Module.ccall("run_lua", 'number', ['string'], [input]);
},
750);
}
</script>
</head>
<body>
<div>
<textarea id="edit" style="width: 800px; height: 480px;" onkeyup="text_changed();">
function hello_lua()
print "Hello Lua!"
end
hello_lua()</textarea>
<div id="result" style="width: 800px; float: right"></div>
</div>
</body>
</html>
Вы можете оставить комментарий после Вход в систему
Неприемлемый контент может быть отображен здесь и не будет показан на странице. Вы можете проверить и изменить его с помощью соответствующей функции редактирования.
Если вы подтверждаете, что содержание не содержит непристойной лексики/перенаправления на рекламу/насилия/вульгарной порнографии/нарушений/пиратства/ложного/незначительного или незаконного контента, связанного с национальными законами и предписаниями, вы можете нажать «Отправить» для подачи апелляции, и мы обработаем ее как можно скорее.
Опубликовать ( 0 )