my.watchShake(OBJECT)
Note: This interface is only supported in mPaaS 10.1.32 and later versions.
This interface is used for the shake function. Each time the API is called, the callback will be triggered after shaking the phone. If you need to listen to it again, call this API again.
Sample code
// API-DEMO page/API/watch-shake/watch-shake.json
{
"defaultTitle": "Shake"
}
<!-- API-DEMO page/API/watch-shake/watch-shake.axml-->
<view class="page">
<button type="primary" onTap="watchShake">
Bind the shake function, and click the Shake button to view the effect
</button>
</view>
// API-DEMO page/API/watch-shake/watch-shake.js
Page({
watchShake() {
my.watchShake({
success: function() {
console.log('It moved')
my.alert({ title:'It moved o.o'});
}
});
},
});