# wx.onAccelerometerChange(function callback)
Listens on the acceleration data event. The frequency is based on the wx.startAccelerometer() interval parameter. You can use wx.stopAccelerometer() to stop listening.
# Parameters
# function callback
The callback function for the acceleration data event.
# Parameters
# Object res
Property | Type | Description |
---|---|---|
x | number | x-axis |
y | number | y-axis |
z | number | z-axis |
# Sample Code
wx.onAccelerometerChange(function (res) {
console.log(res.x)
console.log(res.y)
console.log(res.z)
})