-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Description
Is your feature request related to a problem? Please describe.
There are methods that can be called when using Blazor JS interop: https://docs.microsoft.com/en-us/aspnet/core/blazor/javascript-interop?view=aspnetcore-3.1#invoke-net-methods-from-javascript-functions
However, using these methods in the JS project can be a guessing exercise because the API is barely documented, especially when using TypeScript which requires type declarations to be defined.
Describe the solution you'd like
Example TypeScript interface declaration for Instance method call thing in Blazor JS interop:
interface dotNetHandler {
invokeMethodAsync<T>(methodName: string, ...args): Promise<T>;
}A new package on npm @types/blazor or @types/blazor-js-interop or something like that should be published with all type information for using Blazor JavaScript Interop
Additional context
In my experience, that window.DotNet is a mystery because invokeMethodAsync is always undefined there for some reason. So please add the TypeScript API documentation via @types packages.