2019-07-15 09:36:03 +00:00
|
|
|
<!DOCTYPE html>
|
|
|
|
<html>
|
|
|
|
<head><meta charset="utf-8" /></head>
|
|
|
|
|
|
|
|
<body>
|
2019-11-04 08:44:23 +00:00
|
|
|
<input type="button" value="Open" onclick="do_open();" />
|
|
|
|
<input type="button" value="Run" onclick="do_run();" />
|
|
|
|
<input type="button" value="Close" onclick="do_close();" />
|
|
|
|
|
|
|
|
<script type="text/javascript">
|
|
|
|
var g_WebWorker = new Worker("moo.worker.js");
|
|
|
|
if (typeof(WebAssembly) === 'undefined')
|
|
|
|
{
|
|
|
|
alert ('No web assebly support in this browser');
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
window.addEventListener('beforeunload', function(event) {
|
|
|
|
//g_WebWorker.terminate ();
|
|
|
|
//g_WebWorkder = null;
|
|
|
|
|
|
|
|
var confirmationMessage = "\o/";
|
|
|
|
(event || window.event).returnValue = confirmationMessage; //Gecko + IE
|
|
|
|
return confirmationMessage;
|
|
|
|
});
|
|
|
|
*/
|
|
|
|
|
|
|
|
g_WebWorker.onerror = function (evt) {
|
|
|
|
console.log(`Error from Web Worker: ${evt.message}`);
|
|
|
|
};
|
|
|
|
|
|
|
|
g_WebWorker.onmessage = function (evt) {
|
|
|
|
console.log(`Message from the Web Worker:\n\n ${evt.data}`);
|
|
|
|
};
|
|
|
|
|
|
|
|
function do_open()
|
|
|
|
{
|
|
|
|
g_WebWorker.postMessage({ "cmd": "open-moo", "data": "nothing as of now.." });
|
|
|
|
}
|
|
|
|
|
|
|
|
function do_run()
|
|
|
|
{
|
|
|
|
g_WebWorker.postMessage({ "cmd": "run-moo", "data": "nothing as of now.." });
|
|
|
|
}
|
|
|
|
|
|
|
|
function do_close()
|
|
|
|
{
|
|
|
|
g_WebWorker.postMessage({ "cmd": "close-moo", "data": "nothing as of now.." });
|
|
|
|
}
|
|
|
|
</script>
|
2019-07-15 09:36:03 +00:00
|
|
|
|
|
|
|
|
|
|
|
</body>
|
|
|
|
</html>
|
|
|
|
|