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.
Listen for screen orientation changes.
portrait
landscape
portraitUpsideDown
landscapeLeft
landscapeRight
my.onScreenOrientationChange((res) => { console.log('Orientation changed to:', res.orientation); });
Page({ data: { layout: 'portrait' }, onLoad() { my.onScreenOrientationChange(this.handleOrientationChange); }, handleOrientationChange(res) { const layout = res.orientation.includes('landscape') ? 'landscape' : 'portrait'; this.setData({ layout }); this.adjustLayout(layout); }, adjustLayout(layout) { if (layout === 'landscape') { // Show expanded view this.setData({ columns: 4, showSidebar: true }); } else { // Show compact view this.setData({ columns: 2, showSidebar: false }); } }, onUnload() { my.offScreenOrientationChange(this.handleOrientationChange); } });
Page({ onLoad() { my.onScreenOrientationChange((res) => { if (res.orientation.includes('landscape')) { this.videoContext.requestFullScreen(); } else { this.videoContext.exitFullScreen(); } }); } });
my.offScreenOrientationChange