This code will include the "example.js" file in our application and make the functions defined in the file available for use in our C# code.
public static void ShowAlert(string message)
<button @onclick="@(() => ShowAlert("Hello, world!"))">Show alert</button>
This code adds a button to the component that calls the "ShowAlert" method when clicked. The method displays an alert dialog with the message "Hello, world!".
public static void AddMarker(double lat, double lng)
JSRuntime.Current.InvokeAsync<object>("addMarker", lat, lng);
This code defines a static method named "AddMarker" that takes two double arguments named "lat" and "lng". The method calls the "addMarker" function provided by the Google Maps API with the specified latitude and longitude.
Go here if you would like to see the ASP.Net Core Blazor Official Documentation.