JSRuntime.InvokeAsync Method

Definition

Overloads

InvokeAsync<TValue>(String, Object[])

Invokes the specified JavaScript function asynchronously.

JSRuntime will apply timeouts to this operation based on the value configured in DefaultAsyncTimeout. To dispatch a call with a different, or no timeout, consider using InvokeAsync<TValue>(String, CancellationToken, Object[]).

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

Invokes the specified JavaScript function asynchronously.

InvokeAsync<TValue>(String, Object[])

Invokes the specified JavaScript function asynchronously.

JSRuntime will apply timeouts to this operation based on the value configured in DefaultAsyncTimeout. To dispatch a call with a different, or no timeout, consider using InvokeAsync<TValue>(String, CancellationToken, Object[]).

public:
generic <typename TValue>
 virtual System::Threading::Tasks::ValueTask<TValue> InvokeAsync(System::String ^ identifier, cli::array <System::Object ^> ^ args);
public System.Threading.Tasks.ValueTask<TValue> InvokeAsync<TValue> (string identifier, object[] args);
abstract member InvokeAsync : string * obj[] -> System.Threading.Tasks.ValueTask<'Value>
override this.InvokeAsync : string * obj[] -> System.Threading.Tasks.ValueTask<'Value>
Public Function InvokeAsync(Of TValue) (identifier As String, args As Object()) As ValueTask(Of TValue)

Type Parameters

TValue

The JSON-serializable return type.

Parameters

identifier
String

An identifier for the function to invoke. For example, the value

"someScope.someFunction"
will invoke the function
window.someScope.someFunction
.

args
Object[]

JSON-serializable arguments.

Returns

ValueTask<TValue>

An instance of TValue obtained by JSON-deserializing the return value.

Implements

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

Invokes the specified JavaScript function asynchronously.

public:
generic <typename TValue>
 virtual System::Threading::Tasks::ValueTask<TValue> InvokeAsync(System::String ^ identifier, System::Threading::CancellationToken cancellationToken, cli::array <System::Object ^> ^ args);
public System.Threading.Tasks.ValueTask<TValue> InvokeAsync<TValue> (string identifier, System.Threading.CancellationToken cancellationToken, object[] args);
abstract member InvokeAsync : string * System.Threading.CancellationToken * obj[] -> System.Threading.Tasks.ValueTask<'Value>
override this.InvokeAsync : string * System.Threading.CancellationToken * obj[] -> System.Threading.Tasks.ValueTask<'Value>
Public Function InvokeAsync(Of TValue) (identifier As String, cancellationToken As CancellationToken, args As Object()) As ValueTask(Of TValue)

Type Parameters

TValue

The JSON-serializable return type.

Parameters

identifier
String

An identifier for the function to invoke. For example, the value

"someScope.someFunction"
will invoke the function
window.someScope.someFunction
.

cancellationToken
CancellationToken

A cancellation token to signal the cancellation of the operation. Specifying this parameter will override any default cancellations such as due to timeouts (DefaultAsyncTimeout) from being applied.

args
Object[]

JSON-serializable arguments.

Returns

ValueTask<TValue>

An instance of TValue obtained by JSON-deserializing the return value.

Implements

Applies to