@using Wabbajack.RateLimiter @using System @using System.Reactive.Linq @implements IDisposable @namespace Wabbajack.App.Blazor.Components
@Text
@code { [Parameter] public IObservable? ProgressObserver { get; set; } private double CurrentProgress { get; set; } private string Text { get; set; } = string.Empty; private IDisposable? _disposable; protected override void OnInitialized() { if (ProgressObserver is null) return; _disposable = ProgressObserver .Sample(TimeSpan.FromMilliseconds(250)) .DistinctUntilChanged(p => p.Value) .Subscribe(p => { CurrentProgress = p.Value; Text = p.ToString(); InvokeAsync(StateHasChanged); }); } public void Dispose() => _disposable?.Dispose(); }