UNPKG

2.95 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 PowerManagement
11 * @description
12 * The PowerManagement plugin offers access to the devices power-management functionality.
13 * It should be used for applications which keep running for a long time without any user interaction.
14 *
15 * @usage
16 * ```
17 * import {PowerManagement} from 'ionic-native';
18 *
19 * PowerManagement.acquire()
20 * .then(onSuccess)
21 * .catch(onError);
22 *
23 * ```
24 */
25var PowerManagement = (function () {
26 function PowerManagement() {
27 }
28 /**
29 * Acquire a wakelock by calling this.
30 * @returns {Promise<any>}
31 */
32 PowerManagement.acquire = function () { return; };
33 /**
34 * This acquires a partial wakelock, allowing the screen to be dimmed.
35 * @returns {Promise<any>}
36 */
37 PowerManagement.dim = function () { return; };
38 /**
39 * Release the wakelock. It's important to do this when you're finished with the wakelock, to avoid unnecessary battery drain.
40 * @returns {Promise<any>}
41 */
42 PowerManagement.release = function () { return; };
43 /**
44 * By default, the plugin will automatically release a wakelock when your app is paused (e.g. when the screen is turned off, or the user switches to another app).
45 * It will reacquire the wakelock upon app resume. If you would prefer to disable this behaviour, you can use this function.
46 * @param set {boolean}
47 * @returns {Promise<any>}
48 */
49 PowerManagement.setReleaseOnPause = function (set) { return; };
50 __decorate([
51 plugin_1.Cordova()
52 ], PowerManagement, "acquire", null);
53 __decorate([
54 plugin_1.Cordova()
55 ], PowerManagement, "dim", null);
56 __decorate([
57 plugin_1.Cordova()
58 ], PowerManagement, "release", null);
59 __decorate([
60 plugin_1.Cordova()
61 ], PowerManagement, "setReleaseOnPause", null);
62 PowerManagement = __decorate([
63 plugin_1.Plugin({
64 pluginName: 'PowerManagement',
65 plugin: 'cordova-plugin-powermanagement-orig',
66 pluginRef: 'powerManagement',
67 repo: 'https://github.com/Viras-/cordova-plugin-powermanagement'
68 })
69 ], PowerManagement);
70 return PowerManagement;
71}());
72exports.PowerManagement = PowerManagement;
73//# sourceMappingURL=power-management.js.map
\No newline at end of file