@page "/"
@inject IJSRuntime jsRuntime
Home
@code {
public string temp = " ";
public bool hasInteracted = false; // Has the user interacted with the input field?
protected override async Task OnInitializedAsync()
{
StartAutoTyping();
}
private async void StartAutoTyping()
{
await Task.Delay(1000);
foreach (char letter in "Balls... Itchy... HELP ME!!!")
{
temp += letter;
await InvokeAsync(StateHasChanged); // Trigger UI update
await Task.Delay(200); // Non-blocking delay
if (!hasInteracted) continue;
temp = ""; // Clear input and let user input
await InvokeAsync(StateHasChanged);
return;
}
}
}