Beispiel #1
0
        /// <summary>
        /// Create a WindowInterop instance that can be used for using Browser API
        /// </summary>
        /// <param name="jsRuntime"></param>
        /// <returns></returns>
        public static async ValueTask <WindowInterop> Window(this IJSRuntime jsRuntime)
        {
            var jsObjectRef = await jsRuntime.GetWindowPropertyRef("window").ConfigureAwait(false);

            var wsInterop =
                await jsRuntime.GetInstanceProperty <WindowInterop>(jsObjectRef, "self",
                                                                    WindowInterop.SerializationSpec).ConfigureAwait(false);

            wsInterop.SetJsRuntime(jsRuntime, jsObjectRef);
            return(wsInterop);
        }
Beispiel #2
0
 /// <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 ValueTask <int> Length()
 {
     return(await jsRuntime.GetInstanceProperty <int>(jsRuntimeObjectRef, "history.length"));
 }
 /// <summary>
 /// Represents the time at which the location was retrieved.
 /// </summary>
 /// <value></value>
 public async ValueTask <double> TimeOrigin()
 {
     return(await jsRuntime.GetInstanceProperty <double>(windowRef, "performance.timeOrigin"));
 }
Beispiel #4
0
 /// <summary>
 /// Return true if the element is visible or not
 /// </summary>
 /// <returns></returns>
 public async ValueTask <bool> GetVisible()
 {
     return(await jsRuntime.GetInstanceProperty <bool>(windowRef, $"{propertyName}.visible").ConfigureAwait(false));
 }
 /// <summary>
 /// Count of direct subframes
 /// </summary>
 /// <returns></returns>
 public async ValueTask <int> Length()
 {
     return(await jsRuntime.GetInstanceProperty <int>(jsRuntimeObjectRef, "frames.length").ConfigureAwait(false));
 }
 /// <summary>
 ///  the number of data items stored in the Storage object.
 ///  </summary>
 /// <returns></returns>
 public async ValueTask <int> Length()
 {
     return(await jsRuntime.GetInstanceProperty <int>(await GetJsRuntimeObjectRef(), "length"));
 }