May 19, 2021 WeChat Mini Program Development Document
Listen to compass
data, frequency: 5 times per second,
the interface call will automatically start listening,
wx.stopCompass
stop
listening.
CALLBACK returns parameters:
Parameters | Type | Description |
---|---|---|
direction | Number | The degree of direction faced |
Example code:
wx.onCompassChange(function (res) {
console.log(res.direction)
})
Base library 1.1.0 starts to support, and low versions need to be compatible
Start listening to the arospass data.
OBJECT parameter description:
Parameters | Type | Required | Description |
---|---|---|---|
success | Function | Whether | The interface calls a successful callback function |
fail | Function | Whether | The interface calls the failed callback function |
complete | Function | Whether | Callback function at end of interface call (call succeeds, fails are executed) |
Example code:
wx.startCompass()
Base library 1.1.0 starts to support, and low versions need to be compatible
Stop listening to the arospass data.
OBJECT parameter description:
Parameters | Type | Required | Description |
---|---|---|---|
success | Function | Whether | The interface calls a successful callback function |
fail | Function | Whether | The interface calls the failed callback function |
complete | Function | Whether | Callback function at end of interface call (call succeeds, fails are executed) |
Example code:
wx.stopCompass()
Base Library 2.9.3 starts to support, and low versions need to be compatible
Cancels listening for ppon data change events, with empty parameters, cancels all event listening.
The callback function for the pprow data change event