@using Microsoft.JSInterop @inject IJSRuntime jsRuntime
@code {
protected override async Task OnInitializedAsync()
{
var module = await jsRuntime.InvokeAsync
[JSInvokable] public void JsMethod(string message) { Console.WriteLine("JS invoked with message: " + message); }
private async Task CallJsMethod()
{
var module = await jsRuntime.InvokeAsync
function MyMethod() { DotNet.invokeMethodAsync('ChildComponent', 'JsMethod', 'Hello from JS!'); }