Created
August 18, 2021 14:09
-
-
Save pavelsavara/52bf2a7e3625bdbb747473fb6b2ba432 to your computer and use it in GitHub Desktop.
hot-reload assert
This file contains 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
@page "/" | |
@using System.Diagnostics; | |
@using System; | |
@using System.Timers; | |
@inject IJSRuntime JS | |
<PageTitle>Index</PageTitle> | |
<p> | |
<button @onclick="Test">Test</button> | |
@text | |
</p> | |
@code { | |
private MarkupString text; | |
private static Timer timer; | |
private static DateTime last; | |
private async Task Test() | |
{ | |
timer = new System.Timers.Timer(100); | |
timer.Elapsed += OnTimedEvent; | |
timer.AutoReset = true; | |
timer.Enabled = true; | |
last = DateTime.Now; | |
//Debug.WriteLine("preTest"); | |
//text = new(await JS.InvokeAsync<string>("test", new object[]{1})); | |
} | |
private static void OnTimedEvent(Object? source, System.Timers.ElapsedEventArgs? e) | |
{ | |
Console.WriteLine($" Since last{(e.SignalTime-last).TotalMilliseconds})"); | |
last = e.SignalTime; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment