Question · JavaScript and TypeScript course · Module 10: TypeScript in Practice
Receiving Data from a Web Worker
How do you receive data sent from a Web Worker in the main thread?
Answer options
- Data is automatically available as worker.data
- By calling worker.receive()
- By assigning a function to worker.onmessage or using addEventListener('message')
- By using worker.on('data', callback)
You can check the correct answer by solving this task in the CodeWorlds game.