html5 worker test
This commit is contained in:
parent
1683f3e90f
commit
2e70bf46fa
2 changed files with 36 additions and 0 deletions
33
experiments/worker.html
Normal file
33
experiments/worker.html
Normal file
|
|
@ -0,0 +1,33 @@
|
||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
|
||||||
|
"http://www.w3.org/TR/html4/strict.dtd">
|
||||||
|
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||||
|
<title>worker</title>
|
||||||
|
<meta name="generator" content="TextMate http://macromates.com/">
|
||||||
|
<meta name="author" content="Fabian Jakobs">
|
||||||
|
<!-- Date: 2010-04-08 -->
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<script type="text/javascript" charset="utf-8">
|
||||||
|
|
||||||
|
var worker = new Worker("worker.js");
|
||||||
|
|
||||||
|
worker.onmessage = function(e) {
|
||||||
|
console.log(e.data);
|
||||||
|
};
|
||||||
|
|
||||||
|
worker.onerror = function(e) {
|
||||||
|
console.log(e.data);
|
||||||
|
};
|
||||||
|
|
||||||
|
worker.postMessage("postMessage('juhu')");
|
||||||
|
worker.postMessage("postMessage('juhu')");
|
||||||
|
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
3
experiments/worker.js
Normal file
3
experiments/worker.js
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
onmessage = function(e) {
|
||||||
|
onmessage = new Function("e", e.data);
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue