Utility methods for orientation detection.
| Signature | Description |
|---|---|
| isPortrait() | Returns whether the current screen orientation is portrait or not. |
| isLandscape() | Returns whether the current screen orientation is landscape or not. |
| on(eventName, listener) | Add an event listener. |
| once(eventName, listener) | Add an event listener that's only triggered once. |
| off(eventName, [listener]) | Remove an event listener. If the listener is not specified all listeners for the event type will be removed. |
| Name | Description |
|---|---|
| change | Fired when the device orientation changes. |
Returns whether the current screen orientation is portrait or not.
Returns: Will be true if the current orientation is portrait mode.
Returns whether the current screen orientation is landscape or not.
Returns: Will be true if the current orientation is landscape mode.
Add an event listener.
| Name | Type | Description |
|---|---|---|
| eventName | String | Name of the event. |
| listener | Function | Function to execute when the event is triggered. |
Add an event listener that's only triggered once.
| Name | Type | Description |
|---|---|---|
| eventName | String | Name of the event. |
| listener | Function | Function to execute when the event is triggered. |
Remove an event listener. If the listener is not specified all listeners for the event type will be removed.
| Name | Type | Description |
|---|---|---|
| eventName | String | Name of the event. |
| listener | Function | Function to execute when the event is triggered. |
Fired when the device orientation changes.
| Name | Type | Description |
|---|---|---|
| event | Object | Event object. |
| event.isPortrait | Boolean | Will be true if the current orientation is portrait mode. |