Complete the code to create a web worker in Angular.
const worker = new Worker([1]);Angular web workers are created by specifying the worker file path and the module type.
Complete the code to send a message to the web worker.
worker.[1]('start computation');
Use postMessage to send data to a web worker.
Fix the error in the event listener to receive messages from the worker.
worker.addEventListener('[1]', ({ data }) => { console.log('Result:', data); });
The event name to listen for messages from a worker is message.
Fill both blanks to create a worker and send a message safely.
const worker = new Worker('[1]', { [2] }); worker.postMessage('compute');
Use the worker file path without extension and specify type: 'module' for Angular workers.
Fill all three blanks to create a worker, send a message, and listen for the result.
const worker = new Worker('[1]', { [2] }); worker.[3]('start'); worker.addEventListener('message', event => { console.log('Data:', event.data); });
Use the worker path without extension, specify module type, and send messages with postMessage.
