We would like to propose Tasklets – an API to make it easier for developers to move work off the main thread/UI thread.
Jank remains a problem. While making a lot of APIs asynchronous by default helped, some work is inherently atomic. iOS, Android and other native platforms are very strict about the usage of any APIs not critical to UI manipulation on the main thread. The web seems to be the odd one out. WebWorkers already allow developers to move work to another thread, but are rather expensive and clunky to use with only
postMessage() as a means of communication.
Tasklets would allow developers to move work to another thread in a very ergonomic way. As the name suggests, a Tasklet is a Worklet that runs user code. This means it is more lightweight than a WebWorker. Also, a single OS thread could be shared between multiple tasklets, making it feasible to use on memory-restricted mobile devices as well.
Please take a look at the explainer above for usage, syntax and more details.
@iank, @dknox and myself will be happy to answer any questions you might have.