Skip to content

Commit

Permalink
dispose timer
Browse files Browse the repository at this point in the history
  • Loading branch information
lolochristen committed Jan 15, 2024
1 parent cbf2d87 commit 31b187d
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/OpenLayers.Blazor.Demo.Components/Pages/FlightTracker.razor
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@
@using System.Runtime.InteropServices
@using System.Text.Json.Serialization
@rendermode Components.RenderMode.DefaultRenderMode
@implements IDisposable

<div class="card mt-2 mb-2">
<div class="card-header">
<h3 class="card-title">Flight Tracker</h3>
</div>
<div class="card-body">
<p>Using markers to show flights using API https://api.adsb.lol</p>
<p>Using markers to show flights using API https://api.adsb.lol.</p>
</div>
</div>

Expand Down Expand Up @@ -38,7 +39,7 @@
[Inject]
HttpClient _httpClient { get; set; }

private Timer _timer;
private Timer? _timer;

[Inject]
private ILogger<FlightTracker> _logger { get; set; }
Expand Down Expand Up @@ -112,6 +113,11 @@
await InvokeAsync(StateHasChanged);
}

public void Dispose()
{
_timer?.Dispose();
}

public class AdsbResponse
{
[JsonPropertyName("ac")]
Expand Down

0 comments on commit 31b187d

Please sign in to comment.