Spaces:
Runtime error
Runtime error
File size: 645 Bytes
8df6da4 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
<!doctype html>
<title>Worker</title>
<script>
"use strict";
window.onload = function()
{
var worker = new Worker("worker.js");
var terminal = document.getElementById("terminal");
worker.onmessage = function(e)
{
terminal.textContent += e.data;
}
terminal.onkeypress = function(e)
{
e.preventDefault();
worker.postMessage(String.fromCharCode(e.which));
};
}
var start = Date.now();
setInterval(function()
{
document.getElementById("time").textContent = (Date.now() - start) / 1000 | 0;
});
</script>
<span id=time></span>s
<hr>
<textarea rows=25 cols=80 id=terminal></textarea>
|