JSHost.ImportAsync(String, String, CancellationToken) 方法

定義

透過 JavaScript 主機的 動態匯入 API,從提供的 URL 下載並具現化 ES6 模組。 如果先前已具現化具有所提供 moduleName 的模組,則會改為傳回。

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)

參數

moduleName
String

ES6 模組的全域唯一標識符,由 使用 JSImportAttribute(String, String)

moduleUrl
String

模組檔案的位置。

cancellationToken
CancellationToken

用來監視是否有取消要求的語彙基元。

傳回

包含模組匯出之 JavaScript 物件的 Proxy。

例外狀況

取消標記已取消。 此例外狀況會儲存在傳回的工作中。

適用於