You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
795 B
27 lines
795 B
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<IJSRuntime>(), options);
|
|
|
|
public IResizeObserver Create()
|
|
{
|
|
var options = _provider.GetService<IOptions<ResizeObserverOptions>>();
|
|
return Create(options?.Value ?? new ResizeObserverOptions());
|
|
}
|
|
}
|
|
}
|