Skip to content

A generic invoker to simplify JavaScript to C# interaction that allows for return values

License

Notifications You must be signed in to change notification settings

soenneker/soenneker.blazor.utils.blazoroutputinvoker

Repository files navigation

Soenneker.Blazor.Utils.BlazorOutputInvoker

A generic invoker to simplify JavaScript to C# interaction that allows for an input and output, providing two-way communication with invocations.

Installation

dotnet add package Soenneker.Blazor.Utils.BlazorOutputInvoker

Usage

C#

async ValueTask<int> YourInvokerMethod(string input)
{
    Console.Log(input); // 'Hello there'
    return 42;
}

var blazorOutputInvoker = new BlazorOutputInvoker<string, int>(YourInvokerMethod);

JS

dotnetObject.invokeMethodAsync('InvokeWithOutput', 'Hello there').then((data) => {
    console.log(data); // 42
});

About

A generic invoker to simplify JavaScript to C# interaction that allows for return values

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages