From IT Skills
Jump to: navigation, search

Asynchronous

types[edit]

Transferable[edit]

SharedArrayBuffers[edit]

In most programming languages, the way you usually split up the work is by using something called a thread... In JavaScript, the way you do this is using something called a web worker... These web workers are slightly different than the threads you use in other languages. By default they don’t share memory. This means if you want to share some data with the other thread, you have to copy it over. This is done with the function postMessage... what you really need is to have shared memory. This is what SharedArrayBuffers give you.

iOS versions#10.1 but disabled by default

tools[edit]

comlink: This library provides the RPC-like experience that we want from our workers

Comlink provides a nice transparent API with Proxies... why I don’t use it... With Comlink, the API in the main thread is an async function. You need to put await in front of Comlink.wrap. With React, we can hide the async behavior in hooks. The RPC style is limited. Web Workers are often used for time consuming tasks. We may need to show progress... We use (async) generators