DeviceOrientationEvent Class
The deviceorientation and deviceorientationabsolute events of a window (https://w3c.github.io/deviceorientation/#deviceorientation): the orientation of the device as intrinsic Tait-Bryan angles Z - X' - Y'' in degrees, rounded to 0.1 degree. They are fired when a listener is added and when the orientation sensor of the DeviceSensorProvider of the browsing context gets a new reading, while the document is visible.
public sealed class DeviceOrientationEvent : Event- Inheritance
EventDeviceOrientationEvent
Constructors
| Name | Description |
|---|---|
| DeviceOrientationEvent(string, DeviceOrientationEventInit?) | Creates a device orientation event. |
DeviceOrientationEvent(string, DeviceOrientationEventInit?)
DeviceOrientationEvents.csCreates a device orientation event.
public DeviceOrientationEvent(string type, DeviceOrientationEventInit? eventInitDict = null)Properties
| Name | Description |
|---|---|
| Absolute | Gets whether the orientation is relative to the Earth. |
| Alpha | Gets the rotation around the Z axis, in degrees, or null. |
| Beta | Gets the rotation around the X' axis, in degrees, or null. |
| Gamma | Gets the rotation around the Y'' axis, in degrees, or null. |
Absolute
DeviceOrientationEvents.csGets whether the orientation is relative to the Earth.
public bool Absolute { get; }Property value
See also
Gets the rotation around the Z axis, in degrees, or null.
public double? Alpha { get; }Property value
See also
Gets the rotation around the X' axis, in degrees, or null.
public double? Beta { get; }Property value
See also
Gets the rotation around the Y'' axis, in degrees, or null.
public double? Gamma { get; }Property value
See also
Methods
| Name | Description |
|---|---|
| RequestPermission(bool) | Requests the permissions of the orientation events (https://w3c.github.io/deviceorientation/#dom-deviceorientationevent-requestpermission): accelerometer and gyroscope, and magnetometer when absolute is true. The task fails with a NotAllowedError DomException when a permission would prompt the user without a transient activation. |
RequestPermission(bool)
DeviceOrientationEvents.csRequests the permissions of the orientation events (https://w3c.github.io/deviceorientation/#dom-deviceorientationevent-requestpermission): accelerometer and gyroscope, and magnetometer when absolute is true. The task fails with a NotAllowedError DomException when a permission would prompt the user without a transient activation.
public static Task<PermissionState> RequestPermission(bool absolute = false)