Documentation IndexFetch the complete documentation index at: /llms.txtUse this file to discover all available pages before exploring further.
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Stop watching for device shake events.
my.watchShake()
// Stop watching for shakes my.offWatchShake();
Page({ data: { shakeEnabled: false }, toggleShake() { if (this.data.shakeEnabled) { my.offWatchShake(); this.setData({ shakeEnabled: false }); } else { this.enableShake(); this.setData({ shakeEnabled: true }); } }, enableShake() { my.watchShake({ success: () => { this.handleShake(); if (this.data.shakeEnabled) { this.enableShake(); } } }); }, handleShake() { my.vibrate(); console.log('Shake detected!'); } });
Page({ onShow() { this.startShakeWatch(); }, onHide() { // Stop watching when page is hidden my.offWatchShake(); }, startShakeWatch() { my.watchShake({ success: () => { this.onShake(); this.startShakeWatch(); } }); }, onShake() { // Handle shake event } });
my.offWatchShake()