JsModuleLoadRequest Class
A request to load a module (the arguments of HostLoadImportedModule).
public sealed class JsModuleLoadRequestProperties
| Name | Description |
|---|---|
| Attributes | Gets the import attributes (sorted by key). |
| CurrentRealm | Gets the current realm when the module is requested: the realm of the code that calls import(), which is not the realm of the referrer when the code runs in another realm (e.g. the code of another window evaluated by its eval); the realm of the importing module for a static import. |
| HostDefined | Gets the value given to JsModule.LoadRequestedModules, or null for a dynamic import. |
| IsDynamicImport | Gets whether the request comes from an import() call. |
| Realm | Gets the realm of the referrer: the realm of the module to create. |
| ReferrerHostDefined | Gets the data of the host associated with the referrer. |
| ReferrerModule | Gets the module that imports the module, if the referrer is a module. |
| ReferrerUrl | Gets the URL of the script or the module that imports the module, if any. |
| Specifier | Gets the module specifier. |
| Type | Gets the value of the type import attribute (e.g. "json"), or null. |
Attributes
JsModuleLoader.csGets the import attributes (sorted by key).
public IReadOnlyList<KeyValuePair<string, string>> Attributes { get; }Property value
CurrentRealm
JsModuleLoader.csGets the current realm when the module is requested: the realm of the code that calls import(), which is not the realm of the referrer when the code runs in another realm (e.g. the code of another window evaluated by its eval); the realm of the importing module for a static import.
public JsRealm CurrentRealm { get; }Property value
HostDefined
JsModuleLoader.csGets the value given to JsModule.LoadRequestedModules, or null for a dynamic import.
public object? HostDefined { get; }Property value
IsDynamicImport
JsModuleLoader.csRealm
JsModuleLoader.csReferrerHostDefined
JsModuleLoader.csReferrerModule
JsModuleLoader.csReferrerUrl
JsModuleLoader.csSpecifier
JsModuleLoader.csMethods
| Name | Description |
|---|---|
| Complete(JsModule) | Completes the request with the loaded module (FinishLoadingImportedModule). |
| Fail(JsException) | Fails the request with the value of a JavaScript exception (e.g. the SyntaxError of an invalid module). |
| Fail(JsValue) | Fails the request: the error is the rejection reason of the loading. |
| Fail(string) | Fails the request with a TypeError of the realm. |
Complete(JsModule)
JsModuleLoader.csCompletes the request with the loaded module (FinishLoadingImportedModule).
Parameters
moduleJsModule
Exceptions
InvalidOperationException- The request is already completed.
Remarks
On the thread of the engine (a thread that has entered it, e.g. in JsModuleLoader.LoadImportedModule, or the last thread that entered it), the loading continues now. On another thread (e.g. the continuation of a download), the completion is queued and the loading continues on the thread of the engine, from the next JsEngine.RunJobs.
Fail overloads
Fail(JsException)
JsModuleLoader.csFails the request with the value of a JavaScript exception (e.g. the SyntaxError of an invalid module).
public void Fail(JsException exception)Parameters
exceptionJsException
Fail(JsValue)
JsModuleLoader.csFails the request: the error is the rejection reason of the loading.
Parameters
errorJsValue
Exceptions
InvalidOperationException- The request is already completed.
Remarks
It can be called from any thread, as JsModuleLoadRequest.Complete.
Fail(string)
JsModuleLoader.csFails the request with a TypeError of the realm.
Parameters
messagestring
Exceptions
InvalidOperationException- The request is already completed.
Remarks
It can be called from any thread, as JsModuleLoadRequest.Complete.