Share via


HybridWebView.InvokeJavaScriptAsync<TReturnType> Method

Definition

Invokes a JavaScript method named methodName and optionally passes in the parameter values specified by paramValues by JSON-encoding each one.

public System.Threading.Tasks.Task<TReturnType?> InvokeJavaScriptAsync<TReturnType> (string methodName, System.Text.Json.Serialization.Metadata.JsonTypeInfo<TReturnType> returnTypeJsonTypeInfo, object?[]? paramValues = default, System.Text.Json.Serialization.Metadata.JsonTypeInfo?[]? paramJsonTypeInfos = default);
abstract member InvokeJavaScriptAsync : string * System.Text.Json.Serialization.Metadata.JsonTypeInfo<'ReturnType> * obj[] * System.Text.Json.Serialization.Metadata.JsonTypeInfo[] -> System.Threading.Tasks.Task<'ReturnType>
override this.InvokeJavaScriptAsync : string * System.Text.Json.Serialization.Metadata.JsonTypeInfo<'ReturnType> * obj[] * System.Text.Json.Serialization.Metadata.JsonTypeInfo[] -> System.Threading.Tasks.Task<'ReturnType>
Public Function InvokeJavaScriptAsync(Of TReturnType) (methodName As String, returnTypeJsonTypeInfo As JsonTypeInfo(Of TReturnType), Optional paramValues As Object() = Nothing, Optional paramJsonTypeInfos As JsonTypeInfo() = Nothing) As Task(Of TReturnType)

Type Parameters

TReturnType

The type of the return value.

Parameters

methodName
String

The name of the JavaScript method to invoke.

returnTypeJsonTypeInfo
JsonTypeInfo<TReturnType>

Metadata about deserializing the type of the return value specified by TReturnType.

paramValues
Object[]

Optional array of objects to be passed to the JavaScript method by JSON-encoding each one.

paramJsonTypeInfos
JsonTypeInfo[]

Optional array of metadata about serializing the types of the parameters specified by paramValues.

Returns

Task<TReturnType>

An object of type TReturnType containing the return value of the called method.

Implements

Applies to