spiegel-keyman/common/predictive-text/testing/simple-webworker/index.html

55 lines
2 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<!-- Set the viewport width to match phone and tablet device widths -->
<meta name="viewport" content="width=device-width,user-scalable=no" />
<!-- Allow KeymanWeb to be saved to the iPhone home screen -->
<meta name="apple-mobile-web-app-capable" content="yes" />
<!-- Enable IE9 Standards mode -->
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<title>Basic WebWorker test</title>
<!-- Your page CSS -->
<style type='text/css'>
body {font-family: Tahoma,helvetica;}
h3 {font-size: 1em;font-weight:normal;color: darkred; margin-bottom: 4px}
.test {font-size: 1.5em; width:80%; min-height:30px; border: 1px solid gray;}
#KeymanWebControl {width:50%;min-width:600px;}
</style>
<script>
if(window.Worker) {
var canaryWorker = new Worker('canaryWorker.js');
canaryWorker.onmessage = function(e) {
var counter = e.data; // Number of times the WebWorker has been messaged.
console.log("Received message from the WebWorker: " + e.data);
var txtFeedback = document.getElementById("txtFeedback");
txtFeedback.value = counter + " click(s)";
}
} else {
console.error("WebWorkers are not supported in this browser!");
}
</script>
</head>
<!-- Sample page HTML -->
<body>
<h2>LM Layer Testing - basic WebWorker canary</h2>
<p>This page uses a simple WebWorker useful for ensuring functionality on various platforms.</p>
<input type='text' id='txtFeedback' value="No clicks yet." readonly></input> <br>
<script>
var txtFeedback = document.getElementById("txtFeedback");
txtFeedback.value = "No clicks yet.";
</script>
<input type='button' id='btnInput' onclick='canaryWorker.postMessage("Hello.");' value='Message the WebWorker.' />
<h3><a href="../index.html">Return to testing home page</a></h3>
</body>
</html>