Created
April 13, 2018 13:50
-
-
Save joshuamabina/8ca5ee2b3f557fa0431b56bfc870e7a3 to your computer and use it in GitHub Desktop.
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> | |
<head> | |
<meta charset="UTF-8" /> | |
<meta name="viewport" content="width=device-width" /> | |
<title>Hello world from a worker</title> | |
</head> | |
<body> | |
<script charset="utf-8"> | |
var worker = new Worker('worker.js'); | |
worker.addEventListener('message', function(e) { | |
console.log('Worker said:', e.data); | |
}, false); | |
worker.postMessage('Hello worker'); | |
</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
self.addEventListener('message', function(e) { | |
console.log('World said:', e.data); | |
self.postMessage(e.data); | |
}, false); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment