-
Notifications
You must be signed in to change notification settings - Fork 11.9k
Worklet support #29130
Copy link
Copy link
Open
Labels
angular/build:applicationarea: @angular/buildfeatureLabel used to distinguish feature request from other issuesLabel used to distinguish feature request from other issuesfeature: insufficient votesLabel to add when the not a sufficient number of votes or comments from unique authorsLabel to add when the not a sufficient number of votes or comments from unique authors
Metadata
Metadata
Assignees
Labels
angular/build:applicationarea: @angular/buildfeatureLabel used to distinguish feature request from other issuesLabel used to distinguish feature request from other issuesfeature: insufficient votesLabel to add when the not a sufficient number of votes or comments from unique authorsLabel to add when the not a sufficient number of votes or comments from unique authors
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
selfis 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: