using System; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Options; using Microsoft.JSInterop; namespace Connected.Services { public class ResizeObserverFactory : IResizeObserverFactory { private readonly IServiceProvider _provider; public ResizeObserverFactory(IServiceProvider provider) { _provider = provider; } public IResizeObserver Create(ResizeObserverOptions options) => new ResizeObserver(_provider.GetRequiredService(), options); public IResizeObserver Create() { var options = _provider.GetService>(); return Create(options?.Value ?? new ResizeObserverOptions()); } } }