/// <summary>
 /// Locks the orientation of the containing document to its default orientation
 /// </summary>
 /// <returns></returns>
 public async ValueTask Lock(ScreenOrientationTypeEnum newOrientation)
 {
     await jsRuntime.InvokeInstanceMethod(screenRef, "orientation.lock", newOrientation switch
     {
         ScreenOrientationTypeEnum.Any => "any",
         ScreenOrientationTypeEnum.Natural => "natural",
         ScreenOrientationTypeEnum.Landscape => "landscape",
         ScreenOrientationTypeEnum.Portrait => "portrait",
         ScreenOrientationTypeEnum.PortraitPrimary => "portrait-primary",
         ScreenOrientationTypeEnum.PortraitSecondary => "portrait-secondary",
         ScreenOrientationTypeEnum.LandscapePrimary => "landscape-primary",
         ScreenOrientationTypeEnum.LandscapeSecondary => "landscape-secondary",
         _ => throw new NotSupportedException($"ScreenOrientationTypeEnum: {newOrientation}")
     }).ConfigureAwait(false);
Beispiel #2
0
 /// <summary>
 /// causes the browser to move back one page in the session history. It has the same effect as calling history.go(-1). If there is no previous page, this method call does nothing.
 /// </summary>
 /// <returns></returns>
 public async ValueTask Back()
 {
     await jsRuntime.InvokeInstanceMethod(jsRuntimeObjectRef, "history.back");
 }
 /// <summary>
 /// Prevent the event default behavior
 /// </summary>
 /// <returns></returns>
 public async ValueTask PreventDefault()
 {
     await jsRuntime.InvokeInstanceMethod(jsRuntimeObjectRef, "preventDefault").ConfigureAwait(false);
 }
 /// <summary>
 /// removes the named mark from the browser's performance entry buffer. If the method is called with no arguments, all performance entries with an entry type of "mark" will be removed from the performance entry buffer.
 /// </summary>
 /// <param name="name"></param>
 /// <returns></returns>
 public async ValueTask ClearMarks(string name = null)
 {
     await jsRuntime.InvokeInstanceMethod(windowRef, "performance.clearMarks", name);
 }
 /// <summary>
 /// Will print an error with the given objects in the output if the assertion is not verified
 /// </summary>
 /// <param name="assertion">true or false</param>
 /// <param name="printedObjects">object to print in the console</param>
 /// <returns></returns>
 public async ValueTask Assert(bool assertion, params object[] printedObjects)
 {
     if (IsEnabled)
     {
         await jsRuntime.InvokeInstanceMethod(windowObject, "console.assert", assertion, printedObjects).ConfigureAwait(false);
     }
 }
 /// <summary>
 /// returns the name of the nth key in a given Storage object. The order of keys is user-agent defined, so you should not rely on it.
 /// </summary>
 /// <param name="index"></param>
 /// <returns></returns>
 public async ValueTask <string> Key(int index)
 {
     return(await jsRuntime.InvokeInstanceMethod <string>(await GetJsRuntimeObjectRef(), "key", index));
 }