Note

Access to this page requires authorization. You can try signing in or .

Access to this page requires authorization. You can try .

IJSRuntime.InvokeAsync Method

Definition

Namespace:
Microsoft.JSInterop
Assembly:
Microsoft.JSInterop.dll
Package:
Microsoft.JSInterop v10.0.0
Package:
Microsoft.JSInterop v11.0.0-preview.4.26230.115
Package:
Microsoft.JSInterop v3.0.3
Package:
Microsoft.JSInterop v3.1.18
Package:
Microsoft.JSInterop v5.0.9
Package:
Microsoft.JSInterop v6.0.6
Package:
Microsoft.JSInterop v7.0.5
Package:
Microsoft.JSInterop v8.0.19
Package:
Microsoft.JSInterop v9.0.8

Important

Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.

Overloads

Name Description
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 timeout, 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[])

Source:
IJSRuntime.cs
Source:
IJSRuntime.cs
Source:
IJSRuntime.cs
Source:
IJSRuntime.cs
Source:
IJSRuntime.cs
Source:
IJSRuntime.cs

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 timeout, or no timeout, consider using InvokeAsync<TValue>(String, CancellationToken, Object[]).

public:
generic <typename TValue>
 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);
public System.Threading.Tasks.ValueTask<TValue> InvokeAsync<TValue>(string identifier, object[] args);
abstract member 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.

Applies to

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

Source:
IJSRuntime.cs
Source:
IJSRuntime.cs
Source:
IJSRuntime.cs
Source:
IJSRuntime.cs
Source:
IJSRuntime.cs
Source:
IJSRuntime.cs

Invokes the specified JavaScript function asynchronously.

public:
generic <typename TValue>
 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);
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>
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.

Applies to


Feedback

Was this page helpful?