compassneedscalibration | oncompassneedscalibration event
Fires whenever the device magnetometer changes to a state of unreliable or approximate accuracy.
![]() |
Syntax
| Event Property | object.oncompassneedscalibration = handler; |
|---|---|
| addEventListener Method | object.addEventListener("compassneedscalibration", handler, useCapture) |
Event information
| Synchronous | No |
|---|---|
| Bubbles | No |
| Cancelable | Yes |
Event handler parameters
- pEvtObj [in]
-
Type: IHTMLEventObj
Remarks
The states of unreliable and approximate accuracy are defined by the MagnetometerAccuracy enumeration of the Windows.Devices.Sensors namespace.
This event also fires shortly after a listener is added if the compass is already in an unreliable or approximate accuracy state. It will not fire if the compass accuracy is unknown.
The last known accuracy is tracked on a per-target basis. If the event is fired on a page and then the page is refreshed, a new event will be fired (since there will be a new Window object).
This event is useful in cases where having the user calibrate the compass on their device will increase the accuracy of the data provided by the DeviceOrientationEvent.
See also
