using Connected.Services; using Microsoft.JSInterop; namespace Connected; public interface IBrowserWindowSizeProvider { ValueTask GetBrowserWindowSize(); } /// /// This provider calls the JS method resizeListener.getBrowserWindowSize to get the browser window size /// public class BrowserWindowSizeProvider : IBrowserWindowSizeProvider { private readonly IJSRuntime _jsRuntime; /// /// /// /// public BrowserWindowSizeProvider(IJSRuntime jsRuntime) { this._jsRuntime = jsRuntime; } /// /// Get the current BrowserWindowSize, this includes the Height and Width of the document. /// /// public ValueTask GetBrowserWindowSize() => _jsRuntime.InvokeAsync($"mudResizeListener.getBrowserWindowSize"); }