ModuleScript Class
A module script (https://html.spec.whatwg.org/multipage/webappapis.html#module-script): the root of a module graph, the script of a <script type="module"> element, whose descendants are loaded and that is run by the ScriptEngine (see ScriptEngine.LoadModuleScriptGraph and ScriptEngine.ExecuteModuleScript).
public sealed class ModuleScriptConstructors
| Name | Description |
|---|---|
| ModuleScript(GlobalScope, string, string) | Creates a module script. |
ModuleScript(GlobalScope, string, string)
ModuleScript.csCreates a module script.
public ModuleScript(GlobalScope global, string sourceText, string baseUrl)Parameters
globalGlobalScope- The global object of the realm in which the script runs.
sourceTextstring- The source text of the script.
baseUrlstring- The base URL of the script: the URL of an external script, or the base URL of the document of an inline script.
Properties
| Name | Description |
|---|---|
| BaseUrl | Gets the base URL of the script, used to resolve its module specifiers and as import.meta.url. |
| Element | Gets the script element whose script this is. |
| ErrorToRethrow | Gets or sets the error to rethrow (https://html.spec.whatwg.org/multipage/webappapis.html#concept-script-error-to-rethrow): a parse error, or an error of the module graph, reported when the script runs. Set by the engine. |
| FetchOptions | Gets the options used to fetch the descendants of the script (https://html.spec.whatwg.org/multipage/webappapis.html#descendant-script-fetch-options). |
| Global | Gets the global object of the realm of the script. |
| IsInline | Gets whether the script is an inline script (its source text is the child text content of the element). |
| Record | Gets or sets the record of the script in the engine (e.g. its module record). Set by the engine. |
| SourceText | Gets the source text of the script. |
| SourceTextColumn | Gets the column (0-based, in UTF-16 code units) of the start of the source text in its line (see ModuleScript.SourceTextLine). |
| SourceTextLine | Gets the line (1-based) of the start of the source text in the document of an inline script: the line numbers of its errors are the lines in the document. The default value is 1. |
| Url | Gets the URL of the script, used as the file name of the errors: the URL of an external script, or the URL of the document of an inline script. |
BaseUrl
ModuleScript.csElement
ModuleScript.csErrorToRethrow
ModuleScript.csFetchOptions
ModuleScript.csGets the options used to fetch the descendants of the script (https://html.spec.whatwg.org/multipage/webappapis.html#descendant-script-fetch-options).
public ModuleFetchOptions FetchOptions { get; init; }Property value
Global
ModuleScript.csIsInline
ModuleScript.csRecord
ModuleScript.csSourceText
ModuleScript.csSourceTextColumn
ModuleScript.csGets the column (0-based, in UTF-16 code units) of the start of the source text in its line (see ModuleScript.SourceTextLine).
public int SourceTextColumn { get; init; }