Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/soenneker/soenneker.blazor.utils.blazoroutputinvoker
A generic invoker to simplify JavaScript to C# interaction that allows for return values
https://github.com/soenneker/soenneker.blazor.utils.blazoroutputinvoker
blazor blazoroutputinvoker csharp dotnet invoke invoker util utils
Last synced: about 11 hours ago
JSON representation
A generic invoker to simplify JavaScript to C# interaction that allows for return values
- Host: GitHub
- URL: https://github.com/soenneker/soenneker.blazor.utils.blazoroutputinvoker
- Owner: soenneker
- License: mit
- Created: 2024-01-13T15:22:49.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2024-05-22T16:48:21.000Z (8 months ago)
- Last Synced: 2024-05-22T17:57:59.510Z (8 months ago)
- Topics: blazor, blazoroutputinvoker, csharp, dotnet, invoke, invoker, util, utils
- Language: C#
- Homepage: https://soenneker.com
- Size: 321 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
[![](https://img.shields.io/nuget/v/soenneker.blazor.utils.blazoroutputinvoker.svg?style=for-the-badge)](https://www.nuget.org/packages/soenneker.blazor.utils.blazoroutputinvoker/)
[![](https://img.shields.io/github/actions/workflow/status/soenneker/soenneker.blazor.utils.blazoroutputinvoker/publish-package.yml?style=for-the-badge)](https://github.com/soenneker/soenneker.blazor.utils.blazoroutputinvoker/actions/workflows/publish-package.yml)
[![](https://img.shields.io/nuget/dt/soenneker.blazor.utils.blazoroutputinvoker.svg?style=for-the-badge)](https://www.nuget.org/packages/soenneker.blazor.utils.blazoroutputinvoker/)# ![](https://user-images.githubusercontent.com/4441470/224455560-91ed3ee7-f510-4041-a8d2-3fc093025112.png) 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#
```csharp
async ValueTask YourInvokerMethod(string input)
{
Console.Log(input); // 'Hello there'
return 42;
}var blazorOutputInvoker = new BlazorOutputInvoker(YourInvokerMethod);
```
### JS
```javascript
dotnetObject.invokeMethodAsync('InvokeWithOutput', 'Hello there').then((data) => {
console.log(data); // 42
});
```