Interface Worklet
Hierarchy
- Worklet (view full)
Index
Methods
Methods
addModule
- add
Module (moduleURL, options?): Promise<void> Loads and executes the module script given by moduleURL into all of worklet's global scopes. It can also create additional global scopes as part of this process, depending on the worklet type. The returned promise will fulfill once the script has been successfully loaded and run in all global scopes.
The credentials option can be set to a credentials mode to modify the script-fetching process. It defaults to "same-origin".
Any failures in fetching the script or its dependencies will cause the returned promise to be rejected with an "AbortError" DOMException. Any errors in parsing the script or its dependencies will cause the returned promise to be rejected with the exception generated during parsing.
Parameters
- moduleURL: string | URL
Optional
options: WorkletOptions
Returns Promise<void>
Available only in secure contexts.
MDN Reference