minor
This commit is contained in:
parent
36bf2af5fd
commit
5c56e0d54b
7 changed files with 11 additions and 1 deletions
|
@ -337,3 +337,13 @@ To schedule a new microtask:
|
|||
There's no UI or network event handling between microtasks: they run immediately one after another.
|
||||
|
||||
So one may want to `queueMicrotask` to execute a function asynchronously, but also with the same application state.
|
||||
|
||||
```smart header="Web Workers"
|
||||
For long heavy calculations that shouldn't block the event loop, we can use [Web Workers](https://html.spec.whatwg.org/multipage/workers.html).
|
||||
|
||||
That's a way to run code in another, parallel thread.
|
||||
|
||||
Web Workers can exchange messages with the main process, but they have their own variables, and their own event loop.
|
||||
|
||||
Web Workers do not have access to DOM, so they are useful, mainly, for calculations, to use multiplle CPU cores simultaneously.
|
||||
```
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue