/// <summary> /// Give access to the direct sub-frames of the current window. /// </summary> /// <param name="index">Frame index</param> /// <returns></returns> public async Task <WindowInterop> Get(int index) { var jsObjectRef = await jsRuntime.GetInstancePropertyRefAsync(jsRuntimeObjectRef, $"frames[{index}]"); var windowInterop = await jsRuntime.GetInstancePropertyAsync <WindowInterop>(jsRuntimeObjectRef, $"frames[{index}]", false); windowInterop.SetJsRuntime(jsRuntime, jsObjectRef); return(windowInterop); }
/// <summary> /// Create a WIndowInterop instance that can be used for using Browser API /// </summary> /// <param name="jsRuntime"></param> /// <returns></returns> public static async Task <WindowInterop> Window(this IJSRuntime jsRuntime) { var jsObjectRef = await jsRuntime.GetInstancePropertyAsync("window"); var wsInterop = await jsRuntime.GetInstancePropertyAsync <WindowInterop>(jsObjectRef, "self", false); wsInterop.SetJsRuntime(jsRuntime, jsObjectRef); return(wsInterop); }
/// <summary> /// Represents the time at which the location was retrieved. /// </summary> /// <value></value> public async Task <double> TimeOrigin() { return(await jsRuntime.GetInstancePropertyAsync <double>(windowRef, "performance.timeOrigin")); }
/// <summary> /// Return true if the element is visible or not /// </summary> /// <returns></returns> public async Task <bool> GetVisible() { return(await jSRuntime.GetInstancePropertyAsync <bool>(windowRef, $"{propertyName}.visible")); }
/// <summary> /// Represents the number of elements in the session history, including the currently loaded page. For example, for a page loaded in a new tab this property returns 1. /// </summary> /// <value></value> public async Task <int> Length() { return(await jsRuntime.GetInstancePropertyAsync <int>(jsRuntimeObjectRef, "history.length")); }
/// <summary> /// the number of data items stored in the Storage object. /// </summary> /// <returns></returns> public async Task <int> Length() { return(await jsRuntime.GetInstancePropertyAsync <int>(jsRuntimeObjectRef, memberName + ".length")); }
/// <summary> /// Returns the user choice /// </summary> /// <returns></returns> public async Task <bool> IsAccepted() { return(await jSRuntime.GetInstancePropertyAsync <string>(jsObjectRef, "userChoice") == "accepted"); }