Contact emails
Spec
https://drafts.css-houdini.org/worklets/
Summary
Worklets define a new javascript execution context. This execution context is designed to allow developers to write code which is intended to be run synchronously within the rendering engine, however independent of the main user javascript.
Motivation
This spec was developed in order to allow extension points for CSS (as part of the Houdini effort), which requires running user script in the middle of layout, paint, etc.
As a concrete example, this allows blink to call into user defined layout code, and not have to worry about that code re-invalidating layout, removing DOM, etc.
Worklets are intended to be used for:
Houdini related specifications: (CSS Paint API, CSS Layout API, etc)
CompositorWorker
In addition they are being considered for:
Web Audio API nodes
Media Capture workers: https://github.com/w3c/mediacapture-worker/issues/32
Shadow DOM distribution API: https://github.com/w3c/webcomponents/blob/gh-pages/proposals/Imperative-API-for-Node-Distribution-in-Shadow-DOM.md#4-run-distribution-callback-in-a-separate-scripting-context-or-as-pure-function
Without this specification, the above would rely on Workers instead, which don’t allow multiple execution contexts (which means no work shifting between threads), have APIs such as setTimeout (would need to define what this means in a synchronous setting), and don’t have code isolation.
Interoperability and Compatibility Risk
Compatibility Risk: None, adding a new primitive to the web platform.
Interoperability Risk: None (yet). Not requesting permission to ship. Implementing worklets is meant to unblock implementation & experimentation work on current proposals wishing to use this feature. The implementation and experimentation will allow us to inform the specification.
Ongoing technical constraints
None. Worklets aren’t defined to run on a particular thread, or specify the number of them running. Other specifications which use worklets may specify that a particular WorkletGlobalScope should run on a particular thread.
Will this feature be supported on all six Blink platforms (Windows, Mac, Linux, Chrome OS, Android, and Android WebView)?
Yes.
OWP launch tracking bug
Link to entry on the feature dashboard
https://www.chromestatus.com/features/5275637463908352
Requesting approval to ship?
No.