@using Microsoft.AspNetCore.Blazor.Browser.Interop
@using BasicTestApp.InteropTest
@using Microsoft.AspNetCore.Blazor
Invocations
@foreach (var invocation in Invocations)
{
@invocation.Key
@invocation.Value
}
Return values and exceptions thrown from .NET
@foreach (var returnValue in ReturnValues)
{
@returnValue.Key
@returnValue.Value
}
Exceptions thrown from JavaScript
@nameof(ExceptionFromSyncMethod)
@ExceptionFromSyncMethod?.Message
@nameof(SyncExceptionFromAsyncMethod)
@SyncExceptionFromAsyncMethod?.Message
@nameof(AsyncExceptionFromAsyncMethod)
@AsyncExceptionFromAsyncMethod?.Message
@if (DoneWithInterop)
{
Done with interop.
}
@functions {
public IDictionary ReturnValues { get; set; } = new Dictionary();
public IDictionary Invocations { get; set; } = new Dictionary();
public JavaScriptException ExceptionFromSyncMethod { get; set; }
public JavaScriptException SyncExceptionFromAsyncMethod { get; set; }
public JavaScriptException AsyncExceptionFromAsyncMethod { get; set; }
public bool DoneWithInterop { get; set; }
public async Task InvokeInteropAsync()
{
Console.WriteLine("Starting interop invocations.");
await RegisteredFunction.InvokeAsync