Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/surgicalcoder/BlazorInteropGenerator
Generates Blazor -> Javascript strongly typed interop methods.
https://github.com/surgicalcoder/BlazorInteropGenerator
Last synced: 3 months ago
JSON representation
Generates Blazor -> Javascript strongly typed interop methods.
- Host: GitHub
- URL: https://github.com/surgicalcoder/BlazorInteropGenerator
- Owner: surgicalcoder
- License: mit
- Created: 2022-02-12T11:06:40.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2023-12-12T16:59:05.000Z (11 months ago)
- Last Synced: 2024-07-30T07:05:38.794Z (3 months ago)
- Language: C#
- Size: 15.6 KB
- Stars: 14
- Watchers: 1
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- RSCG_Examples - BlazorInteropGenerator
- csharp-source-generators - BlazorInteropGenerator - ![stars](https://img.shields.io/github/stars/surgicalcoder/BlazorInteropGenerator?style=flat-square&cacheSeconds=604800) ![last commit](https://img.shields.io/github/last-commit/surgicalcoder/BlazorInteropGenerator?style=flat-square&cacheSeconds=86400) Generates Blazor -> Javascript strongly typed interop methods, by parsing the Javascript it self and generating extension methods for IJSRuntime. (Source Generators / Webprogramming)
- awesome-blazor - BlazorInteropGenerator - ![GitHub stars](https://img.shields.io/github/stars/surgicalcoder/BlazorInteropGenerator?style=flat-square&cacheSeconds=604800) ![last commit](https://img.shields.io/github/last-commit/surgicalcoder/BlazorInteropGenerator?style=flat-square&cacheSeconds=86400) Github [Octicons](https://primer.style/design/foundations/icons/) Generates Blazor -> Javascript strongly typed interop methods, by parsing the Javascript it self and generating extension methods for IJSRuntime. (Source generators / Others)
README
# BlazorInteropGenerator
Generates Blazor -> Javascript strongly typed interop methods, by parsing the Javascript it self and generating extension methods for IJSRuntime.## Usage
Firstly, add the project from Nuget - [GoLive.Generator.BlazorInterop](https://www.nuget.org/packages/GoLive.Generator.BlazorInterop/), then add an AdditionalFile in your .csproj named "ApiClientGenerator.json", like so:
```
```
Once that's done, add the settings file and change as required:
```
{
"JavascriptFile": "wwwroot\\assets\\js\\blazorinterop.js",
"JSInit": [
"window={}"
],
"MainJsObject": "window.blazor",
"InvokeVoidString": "await JSRuntime.InvokeVoidAsync(\"{0}\", {1});",
"InvokeString": "return await JSRuntime.InvokeAsync(\"{0}\",{1});"
}```
The `JSInt` option is there if you need to init a value, such as if you have all of your methods under `window.blazor`, you need to init `window`.