A generic invoker to simplify JavaScript to C# interaction that allows for an input and output, providing two-way communication with invocations.
dotnet add package Soenneker.Blazor.Utils.BlazorOutputInvoker
async ValueTask<int> YourInvokerMethod(string input)
{
Console.Log(input); // 'Hello there'
return 42;
}
var blazorOutputInvoker = new BlazorOutputInvoker<string, int>(YourInvokerMethod);
dotnetObject.invokeMethodAsync('InvokeWithOutput', 'Hello there').then((data) => {
console.log(data); // 42
});