A Screen Orientation management
- Version:
-
- 2.0.0
- License:
-
- MIT
- See:
Example
import { Orientation } from '@themgoncalves/super-query'; Orientation.onChange((orientation) => { console.info('Screen orientation changed to: ', orientation); }); const isLocked = Orientation.lock('landscape-primary'); console.info('Screen orientation has locked to landscape-primary? ', isLocked);
Methods
-
<inner> current()
-
Get the current screen orientation
Example
const currentOrientation = Orientation.current(); console.info(currentOrientation);
-
<inner> current()
-
Get the current screen orientation
Example
const currentOrientation = Orientation.current(); console.info(currentOrientation);
-
<inner> isLocked()
-
Return if the screen orientation has been locked.
Returns:
- Type
- Boolean
Example
const isLocked = Orientation.isLocked(); console.info(isLocked);
-
<inner> isLocked()
-
Return if the screen orientation has been locked.
Returns:
- Type
- Boolean
Example
const isLocked = Orientation.isLocked(); console.info(isLocked);
-
<inner> lock()
-
Lock screen orientation
Parameters:
Type Description string | Array.<string> The orientations to be locked
Returns:
- Type
- Boolean
Example
const screenWasLocked = Orientation.lock('landscape-primary'); console.info(screenWasLocked);
-
<inner> lock()
-
Lock screen orientation
Parameters:
Type Description string | Array.<string> The orientations to be locked
Returns:
- Type
- Boolean
Example
const screenWasLocked = Orientation.lock('landscape-primary'); console.info(screenWasLocked);
-
<inner> onChange()
-
Event listener to track Orientation Changes
Parameters:
Type Description function Callback function
Returns:
- New screen orientation
- Type
- String
Example
Orientation.onChange((orientation) => { console.info('Screen orientation has changed to ', orientation); });
-
<inner> onChange()
-
Event listener to track Orientation Changes
Parameters:
Type Description function Callback function
Returns:
- New screen orientation
- Type
- String
Example
Orientation.onChange((orientation) => { console.info('Screen orientation has changed to ', orientation); });
-
<inner> unlock()
-
Unlock the screen orientation
Returns:
- Type
- Boolean
Example
const screenWasUnlocked = Orientation.unlock(); console.info(screenWasUnlocked);
-
<inner> unlock()
-
Unlock the screen orientation
Returns:
- Type
- Boolean
Example
const screenWasUnlocked = Orientation.unlock(); console.info(screenWasUnlocked);