Created
November 20, 2019 12:56
-
-
Save bpk-t/00c3cc261b8484c28feca1891d7dff90 to your computer and use it in GitHub Desktop.
web worker test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<meta http-equiv="X-UA-Compatible" content="ie=edge"> | |
<title>Document</title> | |
</head> | |
<body> | |
<h1>WebWorker</h1> | |
<script> | |
var worker = new Worker('worker.js'); | |
worker.postMessage(1); | |
worker.postMessage(2); | |
worker.postMessage(3); | |
worker.postMessage(4); | |
worker.postMessage(5); | |
</script> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
onmessage = function(e) { | |
this.console.log("recv mes = " + e.data); | |
var sum = 0; | |
for (var i = 0; i < 999999; i++) { | |
for (var j = 0; j < 999999; j++) { | |
sum += j; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment