blob: 665d3c710382cb5ba6a476deed9cb8faa080c3a2 [file] [log] [blame] [raw]
<!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>