Worklet support #29130
Labels
angular/build:application
area: @angular/build
feature: votes required
Feature request which is currently still in the voting phase
feature
Issue that requests a new feature
Which @angular/* package(s) are relevant/related to the feature request?
compiler
Description
The worklets are light weighted version of web workers. Currently Angular supports web workers, but not worklets, this makes us unable to make use of Angular's Typescript and bundling support when writing a worklet (i.e. we have to write the worklet in pure Javasctript, or deal with compiling and bundling ourselves).
Proposed solution
Support worklet like web workers.
Alternatives considered
For now we have come to a hacky workaround:
Write the worklet as if it's a web worker. This is perfecly supported by Angular. Now the problem is, to load the compiled worker script, we don't have a trivial way to get its URL.
Wrap the worker code like this:
When
self
is notundefined
, we know this script is loaded as a webworker (in a worklet context it would beundefined
). In this case, send the script's location bypostMessage
.E.g. load an audio worklet:
The text was updated successfully, but these errors were encountered: