UNPKG

2.8 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 Flashlight
11 * @description This plugin allows you to switch the flashlight / torch of the device on and off.
12 *
13 * Requires Cordova plugin: `cordova-plugin-flashlight`. For more info, please see the [Flashlight plugin docs](https://github.com/EddyVerbruggen/Flashlight-PhoneGap-Plugin).
14 *
15 * @usage
16 * ```typescript
17 * import { Flashlight } from 'ionic-native';
18 *
19 *
20 *
21 * ```
22 */
23var Flashlight = (function () {
24 function Flashlight() {
25 }
26 /**
27 * Checks if the flashlight is available
28 * @returns {Promise<boolean>} Returns a promise that resolves with a boolean stating if the flashlight is available.
29 */
30 Flashlight.available = function () { return; };
31 /**
32 * Switches the flashlight on
33 * @returns {Promise<boolean>}
34 */
35 Flashlight.switchOn = function () { return; };
36 /**
37 * Switches the flashlight off
38 * @returns {Promise<boolean>}
39 */
40 Flashlight.switchOff = function () { return; };
41 /**
42 * Toggles the flashlight
43 * @returns {Promise<any>}
44 */
45 Flashlight.toggle = function () { return; };
46 /**
47 * Checks if the flashlight is turned on.
48 * @returns {boolean}
49 */
50 Flashlight.isSwitchedOn = function () { return; };
51 __decorate([
52 plugin_1.Cordova()
53 ], Flashlight, "available", null);
54 __decorate([
55 plugin_1.Cordova()
56 ], Flashlight, "switchOn", null);
57 __decorate([
58 plugin_1.Cordova()
59 ], Flashlight, "switchOff", null);
60 __decorate([
61 plugin_1.Cordova()
62 ], Flashlight, "toggle", null);
63 __decorate([
64 plugin_1.Cordova({
65 sync: true
66 })
67 ], Flashlight, "isSwitchedOn", null);
68 Flashlight = __decorate([
69 plugin_1.Plugin({
70 pluginName: 'Flashlight',
71 plugin: 'cordova-plugin-flashlight',
72 pluginRef: 'window.plugins.flashlight',
73 repo: 'https://github.com/EddyVerbruggen/Flashlight-PhoneGap-Plugin.git'
74 })
75 ], Flashlight);
76 return Flashlight;
77}());
78exports.Flashlight = Flashlight;
79//# sourceMappingURL=flashlight.js.map
\No newline at end of file