examples/events.html
<html>
<head>
<meta charset="utf-8">
</head>
<body>
<script src="../thread.js"></script>
<script>
var worker = thread()
worker.run(function (done) {
setTimeout(function () {
done('invalid')
}, 10)
})['catch'](function (err) {
console.log('Error:', err)
})
worker.on('message', function (msg) {
console.log('Message:', msg)
})
worker.on('error', function (err) {
console.log('Error:', err)
})
// future API
worker.on('start', function () {})
worker.on('end', function () {})
</script>
</body>
</html>