2021-10-25 18:34:55 +03:00
|
|
|
using Microsoft.JSInterop;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
|
|
|
|
namespace WotBlitzStatisticsPro.Blazor.Services
|
|
|
|
|
{
|
|
|
|
|
public class MediaQueriesService : IMediaQueriesService
|
|
|
|
|
{
|
|
|
|
|
private readonly IJSRuntime _jsRuntime;
|
|
|
|
|
|
|
|
|
|
public MediaQueriesService(IJSRuntime jsRuntime)
|
|
|
|
|
{
|
|
|
|
|
_jsRuntime = jsRuntime;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public ValueTask<bool> IsScreenWidthLessThen(long widthInPx)
|
|
|
|
|
{
|
|
|
|
|
return _jsRuntime.InvokeAsync<bool>("mediaQueries.IsScreenWidthLessThen", widthInPx);
|
|
|
|
|
}
|
2022-07-20 17:41:30 +02:00
|
|
|
|
|
|
|
|
public ValueTask<int> WindowHeight()
|
|
|
|
|
{
|
|
|
|
|
return _jsRuntime.InvokeAsync<int>("mediaQueries.ScreenHeight");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public ValueTask<int> WindowWidth()
|
|
|
|
|
{
|
|
|
|
|
return _jsRuntime.InvokeAsync<int>("mediaQueries.ScreenWidth");
|
|
|
|
|
}
|
2021-10-25 18:34:55 +03:00
|
|
|
}
|
|
|
|
|
}
|