A simple test for maybe doing events in the backgrounds between pages in Blazor.
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

at main 18 lines 575 B view raw
1namespace EventsInBlazorTests.Services; 2 3internal class NotifyService(ILogger<NotifyService> logger) 4{ 5 public event Action? OnNotificationReceived; 6 7 // Sendet eine Benachrichtigung an alle registrierten Abonnenten. 8 public void SendNotification() 9 { 10 logger.LogInformation("Sende Benachrichtigung"); 11 NotificationReceivedHandler(); 12 logger.LogInformation("Benachrichtigung gesendet"); 13 } 14 15 16 // Klasseninterne Funktion zum Triggern des Eventhandlers 17 private void NotificationReceivedHandler() => OnNotificationReceived?.Invoke(); 18}