Skip to content

sud.onCompassChange ​

JS
    sud.onCompassChange(function callback)

Listens for compass data change events.

Interval: 5 times/second. Listening starts automatically after the interface is called, and can be stopped with sud.stopCompass.

Parameters

  • function callback: Callback function for compass data change events

Parameters of the callback function

  • Object res: Returns compass data

Properties of the compass data:

PropertyTypeDescription
directionnumberDegrees of the facing direction
accuracynumber/stringAccuracy