UNPKG

2.26 kBTypeScriptView Raw
1/**
2 * @name Screen Orientation
3 * @description
4 * Cordova plugin to set/lock the screen orientation in a common way for iOS, Android, WP8 and Blackberry 10.
5 * This plugin is based on an early version of Screen Orientation API so the api does not currently match the current spec.
6 *
7 * Requires Cordova plugin: `cordova-plugin-screen-orientation`. For more info, please see the [Screen Orientation plugin docs](https://github.com/apache/cordova-plugin-screen-orientation).
8 *
9 * @usage
10 * ```typescript
11 * import { ScreenOrientation } from 'ionic-native';
12 *
13 *
14 * // set to either landscape
15 * ScreenOrientation.lockOrientation('landscape');
16 *
17 * // allow user rotate
18 * ScreenOrientation.unlockOrientation();
19 * ```
20 *
21 * @advanced
22 *
23 * Accepted orientation values:
24 *
25 * | Value | Description |
26 * |-------------------------------|------------------------------------------------------------------------------|
27 * | portrait-primary | The orientation is in the primary portrait mode. |
28 * | portrait-secondary | The orientation is in the secondary portrait mode. |
29 * | landscape-primary | The orientation is in the primary landscape mode. |
30 * | landscape-secondary | The orientation is in the secondary landscape mode. |
31 * | portrait | The orientation is either portrait-primary or portrait-secondary (sensor). |
32 * | landscape | The orientation is either landscape-primary or landscape-secondary (sensor). |
33 *
34 */
35export declare class ScreenOrientation {
36 /**
37 * Lock the orientation to the passed value.
38 * See below for accepted values
39 * @param orientation {string} The orientation which should be locked. Accepted values see table above.
40 */
41 static lockOrientation(orientation: string): void;
42 /**
43 * Unlock and allow all orientations.
44 */
45 static unlockOrientation(): void;
46 /**
47 * Get the current orientation of the device.
48 */
49 static orientation: string;
50}