tencent cloud

All product documents
Tencent Cloud Super App as a Service
Screen Orientation
Last updated: 2025-04-10 18:18:36
Screen Orientation
Last updated: 2025-04-10 18:18:36

onDeviceOrientationChange

This API is called using wx.onDeviceOrientationChange(function listener).
Feature description:Listens for screen orientation change event.
Parameter and description: function listener.The function that handles screen orientation change event. Parameters are as follows:
Property
Type
Description
value
string
The new screen orientation.
landscape: Landscape mode with the HOME button on the right.
landscapeReverse: Landscape mode with the HOME button on the left.
Note:wx.onDeviceOrientationChange only listens for changes between left and right landscape orientations and is effective only when deviceOrientation is set to landscape in game.json.

offDeviceOrientationChange

This API is called using wx.offDeviceOrientationChange(function listener).
Feature description:Removes the listener for screen orientation change event.
Parameter and description: function listener.The function that was passed to onDeviceOrientationChange. If not provided, all listeners will be removed.
Example:
const listener = function (res) { console.log(res) }

wx.onDeviceOrientationChange(listener)
wx.offDeviceOrientationChange(listener) // Must pass the same function object used in onDeviceOrientationChange


Was this page helpful?
You can also Contact Sales or Submit a Ticket for help.
Yes
No

Feedback

Contact Us

Contact our sales team or business advisors to help your business.

Technical Support

Open a ticket if you're looking for further assistance. Our Ticket is 7x24 available.

7x24 Phone Support