WeChat Mini Program API Luopan


wx.onCompassChange(CALLBACK)

Monitor compass data, frequency: 5 times/second

CALLBACK return parameters:

##directionNumberFacing direction degrees
ParametersTypeDescription

Sample code:

wx.onCompassChange(function (res) {
  console.log(res.direction)
})