Skip to content

Instantly share code, notes, and snippets.

@sudodoki
Created August 10, 2013 10:43
Show Gist options
  • Save sudodoki/6199982 to your computer and use it in GitHub Desktop.
Save sudodoki/6199982 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title></title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
<p>Open your browser's console to see the results.</p>
<script id="worker" type="app/worker">
addEventListener('message', function() {
postMessage('Im reading Tech.pro');
}, false);
</script>
<script>
(function() {
var blob = new Blob([document.querySelector('#worker').textContent]),
url,
worker;
url = window.URL.createObjectURL(blob);
worker = new Worker(url);
worker.addEventListener('message', function(e) {
console.log(e.data);
}, false);
worker.postMessage('');
})();
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment