Breyta

Deila með


JSHost.ImportAsync(String, String, CancellationToken) Method

Definition

Downloads and instantiates an ES6 module from the provided URL, via the JavaScript host's dynamic import API. If a module with the provided moduleName has previously been instantiated, it will be returned instead.

public static System.Threading.Tasks.Task<System.Runtime.InteropServices.JavaScript.JSObject> ImportAsync (string moduleName, string moduleUrl, System.Threading.CancellationToken cancellationToken = default);
static member ImportAsync : string * string * System.Threading.CancellationToken -> System.Threading.Tasks.Task<System.Runtime.InteropServices.JavaScript.JSObject>
Public Shared Function ImportAsync (moduleName As String, moduleUrl As String, Optional cancellationToken As CancellationToken = Nothing) As Task(Of JSObject)

Parameters

moduleName
String

Globally unique identifier of the ES6 module, which is used by JSImportAttribute(String, String).

moduleUrl
String

The location of the module file.

cancellationToken
CancellationToken

The token to monitor for cancellation requests.

Returns

A proxy for the JavaScript object that contains the module's exports.

Exceptions

The cancellation token was canceled. This exception is stored into the returned task.

Applies to