using Microsoft.AspNetCore.Components; using Microsoft.JSInterop; using Daybreak.Shared.Models; namespace Daybreak.Shared.Extensions; public static class JSRuntimeExtensions { public static async Task GetBoundingClientRect(this IJSRuntime jsRuntime, ElementReference element, CancellationToken cancellationToken = default) { return await jsRuntime.InvokeAsync("getElementBoundingRect", cancellationToken, element); } public static async Task HoverDelayStart(this IJSRuntime jsRuntime, DotNetObjectReference element, string callback, CancellationToken cancellationToken = default) where T : class { await jsRuntime.InvokeVoidAsync("hoverDelay.start", cancellationToken, element, callback); } public static async Task HoverDelayStop(this IJSRuntime jsRuntime, CancellationToken cancellationToken = default) { await jsRuntime.InvokeVoidAsync("hoverDelay.stop", cancellationToken); } }