docs: update web-worker syntax (#42306)
With this change we update the worker initialization syntax to reflect that used in Angular CLI 12. Closes #42302 PR Close #42306
This commit is contained in:
parent
29e5d509aa
commit
d15a6a3a71
|
@ -42,7 +42,7 @@ The command performs the following actions.
|
|||
<code-example language="typescript" header="src/app/app.component.ts">
|
||||
if (typeof Worker !== 'undefined') {
|
||||
// Create a new
|
||||
const worker = new Worker('./app.worker', { type: 'module' });
|
||||
const worker = new Worker(new URL('./app.worker', import.meta.url));
|
||||
worker.onmessage = ({ data }) => {
|
||||
console.log(`page got message: ${data}`);
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue