# wx.onAccelerometerChange(function callback)
with Promise style call: Not supported
Mini Program plugin: Not supported
Listen for acceleration data events. Frequency basis wx.startAccelerometer() of interval Parameters, Interface calls automatically start listening.
# parameter
# function callback
Acceleration Data Event Callback Function
# parameter
# Object res
attribute | type | Introductions |
---|---|---|
x | number | X axis |
and | number | And axis |
with | number | With |
axis |
# sample code
wx.onAccelerometerChange(callback)