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
Sensor Magnetometer

Constructors

NameDescription
Magnetometer(MagnetometerSensorOptions?)Creates a magnetometer. Throws a SecurityError DomException when the document is not allowed to use the magnetometer feature.

Magnetometer(MagnetometerSensorOptions?)

MotionSensors.cs

Creates a magnetometer. Throws a SecurityError DomException when the document is not allowed to use the magnetometer feature.

public Magnetometer(MagnetometerSensorOptions? sensorOptions = null)

Properties

NameDescription
XGets the magnetic field along the X axis, or null.
YGets the magnetic field along the Y axis, or null.
ZGets 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; }