soenneker / soenneker.blazor.utils.blazorinvoker

A generic invoker to simplify JavaScript to C# interaction

Home Page:https://soenneker.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Soenneker.Blazor.Utils.BlazorInvoker

A generic invoker to simplify JavaScript to C# interaction

BlazorInvoker<TInput> is an encapsulation class designed as a generic invocation point from JS to C#. It's used for 'fire-and-forget' with no return value.

Installation

dotnet add package Soenneker.Blazor.Utils.BlazorInvoker

Usage

C#

var stringInvoker = new BlazorInvoker<string>(async (input) =>
{
    await SomeAsyncOperation(input);
});

JS

dotnetObject.invokeMethodAsync('Invoke', 'JavaScript argument');

About

A generic invoker to simplify JavaScript to C# interaction

https://soenneker.com

License:MIT License


Languages

Language:C# 100.0%