| 1 |
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" |
| 2 |
"http://www.w3.org/TR/html4/strict.dtd"> |
| 3 |
|
| 4 |
<html lang="en"> |
| 5 |
<head> |
| 6 |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
| 7 |
<title>worker</title> |
| 8 |
<meta name="generator" content="TextMate http://macromates.com/"> |
| 9 |
<meta name="author" content="Fabian Jakobs"> |
| 10 |
<!-- Date: 2010-04-08 --> |
| 11 |
</head> |
| 12 |
<body> |
| 13 |
|
| 14 |
<script type="text/javascript" charset="utf-8"> |
| 15 |
|
| 16 |
var worker = new Worker("worker.js"); |
| 17 |
|
| 18 |
worker.onmessage = function(e) { |
| 19 |
console.log(e.data); |
| 20 |
}; |
| 21 |
|
| 22 |
worker.onerror = function(e) { |
| 23 |
console.log(e.data); |
| 24 |
}; |
| 25 |
|
| 26 |
worker.postMessage("postMessage('juhu')"); |
| 27 |
worker.postMessage("postMessage('juhu')"); |
| 28 |
|
| 29 |
|
| 30 |
</script> |
| 31 |
|
| 32 |
</body> |
| 33 |
</html> |