JSRuntimeExtensions.InvokeAsync 方法

定义

重载

InvokeAsync<TValue>(IJSRuntime, String, Object[])

异步调用指定的 JavaScript 函数。

JSRuntime 将根据 中 DefaultAsyncTimeout配置的值对此操作应用超时。 若要调度具有不同超时或无超时的调用,请考虑使用 InvokeAsync<TValue>(String, CancellationToken, Object[])

InvokeAsync<TValue>(IJSRuntime, String, CancellationToken, Object[])

异步调用指定的 JavaScript 函数。

InvokeAsync<TValue>(IJSRuntime, String, TimeSpan, Object[])

异步调用指定的 JavaScript 函数。

InvokeAsync<TValue>(IJSRuntime, String, Object[])

异步调用指定的 JavaScript 函数。

JSRuntime 将根据 中 DefaultAsyncTimeout配置的值对此操作应用超时。 若要调度具有不同超时或无超时的调用,请考虑使用 InvokeAsync<TValue>(String, CancellationToken, Object[])

public:
generic <typename TValue>
[System::Runtime::CompilerServices::Extension]
 static System::Threading::Tasks::ValueTask<TValue> InvokeAsync(Microsoft::JSInterop::IJSRuntime ^ jsRuntime, System::String ^ identifier, ... cli::array <System::Object ^> ^ args);
public static System.Threading.Tasks.ValueTask<TValue> InvokeAsync<TValue> (this Microsoft.JSInterop.IJSRuntime jsRuntime, string identifier, params object[] args);
public static System.Threading.Tasks.ValueTask<TValue> InvokeAsync<TValue> (this Microsoft.JSInterop.IJSRuntime jsRuntime, string identifier, params object?[]? args);
static member InvokeAsync : Microsoft.JSInterop.IJSRuntime * string * obj[] -> System.Threading.Tasks.ValueTask<'Value>
<Extension()>
Public Function InvokeAsync(Of TValue) (jsRuntime As IJSRuntime, identifier As String, ParamArray args As Object()) As ValueTask(Of TValue)

类型参数

TValue

JSON 可序列化的返回类型。

参数

jsRuntime
IJSRuntime

IJSRuntime

identifier
String

要调用的函数的标识符。 例如, 值 "someScope.someFunction" 将调用函数 window.someScope.someFunction

args
Object[]

JSON 可序列化参数。

返回

ValueTask<TValue>

通过对返回值进行 JSON 反序列化获取的 实例 TValue

适用于

InvokeAsync<TValue>(IJSRuntime, String, CancellationToken, Object[])

异步调用指定的 JavaScript 函数。

public:
generic <typename TValue>
[System::Runtime::CompilerServices::Extension]
 static System::Threading::Tasks::ValueTask<TValue> InvokeAsync(Microsoft::JSInterop::IJSRuntime ^ jsRuntime, System::String ^ identifier, System::Threading::CancellationToken cancellationToken, ... cli::array <System::Object ^> ^ args);
public static System.Threading.Tasks.ValueTask<TValue> InvokeAsync<TValue> (this Microsoft.JSInterop.IJSRuntime jsRuntime, string identifier, System.Threading.CancellationToken cancellationToken, params object[] args);
public static System.Threading.Tasks.ValueTask<TValue> InvokeAsync<TValue> (this Microsoft.JSInterop.IJSRuntime jsRuntime, string identifier, System.Threading.CancellationToken cancellationToken, params object?[]? args);
static member InvokeAsync : Microsoft.JSInterop.IJSRuntime * string * System.Threading.CancellationToken * obj[] -> System.Threading.Tasks.ValueTask<'Value>
<Extension()>
Public Function InvokeAsync(Of TValue) (jsRuntime As IJSRuntime, identifier As String, cancellationToken As CancellationToken, ParamArray args As Object()) As ValueTask(Of TValue)

类型参数

TValue

JSON 可序列化的返回类型。

参数

jsRuntime
IJSRuntime

IJSRuntime

identifier
String

要调用的函数的标识符。 例如, 值 "someScope.someFunction" 将调用函数 window.someScope.someFunction

cancellationToken
CancellationToken

用于指示取消操作的取消标记。 指定此参数将替代任何默认取消,例如由于应用超时 (DefaultAsyncTimeout) 。

args
Object[]

JSON 可序列化参数。

返回

ValueTask<TValue>

通过对返回值进行 JSON 反序列化获取的 实例 TValue

适用于

InvokeAsync<TValue>(IJSRuntime, String, TimeSpan, Object[])

异步调用指定的 JavaScript 函数。

public:
generic <typename TValue>
[System::Runtime::CompilerServices::Extension]
 static System::Threading::Tasks::ValueTask<TValue> InvokeAsync(Microsoft::JSInterop::IJSRuntime ^ jsRuntime, System::String ^ identifier, TimeSpan timeout, ... cli::array <System::Object ^> ^ args);
public static System.Threading.Tasks.ValueTask<TValue> InvokeAsync<TValue> (this Microsoft.JSInterop.IJSRuntime jsRuntime, string identifier, TimeSpan timeout, params object[] args);
public static System.Threading.Tasks.ValueTask<TValue> InvokeAsync<TValue> (this Microsoft.JSInterop.IJSRuntime jsRuntime, string identifier, TimeSpan timeout, params object?[]? args);
static member InvokeAsync : Microsoft.JSInterop.IJSRuntime * string * TimeSpan * obj[] -> System.Threading.Tasks.ValueTask<'Value>
<Extension()>
Public Function InvokeAsync(Of TValue) (jsRuntime As IJSRuntime, identifier As String, timeout As TimeSpan, ParamArray args As Object()) As ValueTask(Of TValue)

类型参数

TValue

参数

jsRuntime
IJSRuntime

IJSRuntime

identifier
String

要调用的函数的标识符。 例如, 值 "someScope.someFunction" 将调用函数 window.someScope.someFunction

timeout
TimeSpan

取消异步操作的持续时间。 替代) (DefaultAsyncTimeout 默认超时。

args
Object[]

JSON 可序列化参数。

返回

ValueTask<TValue>

表示 ValueTask 异步调用操作的 。

适用于