Created
November 14, 2022 15:24
-
-
Save jabed-web-dev/012d4434bfb8d86a8bd393e4b9c33a2d to your computer and use it in GitHub Desktop.
blazor server log to browser console
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <h1>Counter</h1> | |
| <p role="status">Current count: @currentCount</p> | |
| <button class="btn btn-primary" @onclick="IncrementCount">Click me</button> | |
| @code { | |
| [Inject] | |
| public IJSRuntime JSRuntime { get; set; } = null!; | |
| public async void ConsoleLog(int arg) | |
| { | |
| await JSRuntime.InvokeVoidAsync("console.log", arg); | |
| } | |
| private int currentCount = 0; | |
| private void IncrementCount() | |
| { | |
| currentCount++; | |
| ConsoleLog(currentCount); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment