Magnetometer Class
The magnetometer (https://w3c.github.io/magnetometer/#magnetometer-interface): the magnetic field around the device, in µT. It reads the DeviceSensorType.Magnetometer sensor of the device, and needs the magnetometer permission and permissions policy feature.
public sealed class Magnetometer : Sensor- Inheritance
SensorMagnetometer
Constructors
| Name | Description |
|---|---|
| Magnetometer(MagnetometerSensorOptions?) | Creates a magnetometer. Throws a SecurityError DomException when the document is not allowed to use the magnetometer feature. |
Magnetometer(MagnetometerSensorOptions?)
MotionSensors.csCreates a magnetometer. Throws a SecurityError DomException when the document is not allowed to use the magnetometer feature.
public Magnetometer(MagnetometerSensorOptions? sensorOptions = null)Properties
| Name | Description |
|---|---|
| X | Gets the magnetic field along the X axis, or null. |
| Y | Gets the magnetic field along the Y axis, or null. |
| Z | Gets the magnetic field along the Z axis, or null. |
Gets the magnetic field along the X axis, or null.
public double? X { get; }Gets the magnetic field along the Y axis, or null.
public double? Y { get; }Gets the magnetic field along the Z axis, or null.
public double? Z { get; }