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:
|
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)