UNPKG

3.72 kBJavaScriptView Raw
1"use strict";
2var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5 else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6 return c > 3 && r && Object.defineProperty(target, key, r), r;
7};
8var plugin_1 = require('./plugin');
9/**
10 * @name Screen Orientation
11 * @description
12 * Cordova plugin to set/lock the screen orientation in a common way for iOS, Android, WP8 and Blackberry 10.
13 * This plugin is based on an early version of Screen Orientation API so the api does not currently match the current spec.
14 *
15 * 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).
16 *
17 * @usage
18 * ```typescript
19 * import { ScreenOrientation } from 'ionic-native';
20 *
21 *
22 * // set to either landscape
23 * ScreenOrientation.lockOrientation('landscape');
24 *
25 * // allow user rotate
26 * ScreenOrientation.unlockOrientation();
27 * ```
28 *
29 * @advanced
30 *
31 * Accepted orientation values:
32 *
33 * | Value | Description |
34 * |-------------------------------|------------------------------------------------------------------------------|
35 * | portrait-primary | The orientation is in the primary portrait mode. |
36 * | portrait-secondary | The orientation is in the secondary portrait mode. |
37 * | landscape-primary | The orientation is in the primary landscape mode. |
38 * | landscape-secondary | The orientation is in the secondary landscape mode. |
39 * | portrait | The orientation is either portrait-primary or portrait-secondary (sensor). |
40 * | landscape | The orientation is either landscape-primary or landscape-secondary (sensor). |
41 *
42 */
43var ScreenOrientation = (function () {
44 function ScreenOrientation() {
45 }
46 /**
47 * Lock the orientation to the passed value.
48 * See below for accepted values
49 * @param orientation {string} The orientation which should be locked. Accepted values see table above.
50 */
51 ScreenOrientation.lockOrientation = function (orientation) { };
52 /**
53 * Unlock and allow all orientations.
54 */
55 ScreenOrientation.unlockOrientation = function () { };
56 __decorate([
57 plugin_1.Cordova({ sync: true })
58 ], ScreenOrientation, "lockOrientation", null);
59 __decorate([
60 plugin_1.Cordova({ sync: true })
61 ], ScreenOrientation, "unlockOrientation", null);
62 __decorate([
63 plugin_1.CordovaProperty
64 ], ScreenOrientation, "orientation", void 0);
65 ScreenOrientation = __decorate([
66 plugin_1.Plugin({
67 pluginName: 'ScreenOrientation',
68 plugin: 'cordova-plugin-screen-orientation',
69 pluginRef: 'window.screen',
70 repo: 'https://github.com/apache/cordova-plugin-screen-orientation',
71 platforms: ['Android', 'iOS', 'Windows Phone 8']
72 })
73 ], ScreenOrientation);
74 return ScreenOrientation;
75}());
76exports.ScreenOrientation = ScreenOrientation;
77//# sourceMappingURL=screen-orientation.js.map
\No newline at end of file