I'm developing a Blazor extension library.
One thing in this library would be the reuse of the javascript alert() method. I know how to do this, this involves adding this in a .cshtml page:
<script>
Blazor.registerFunction('Alert', (message) => {
alert(message);
});
</script>
and this in my code:
public void Alert(string message)
{
RegisteredFunction.Invoke<object>("Alert", message);
}
I would like the javascript part somehow to be auto injected in the html if you use my package (or maybe always). Not sure if this is possible (yet)
Any ideas on this?