Merge pull request #214 from Inoverse/master

Implemented wrapper for display brightness control
This commit is contained in:
Ibrahim Hadeed 2016-06-11 20:26:52 -04:00 committed by GitHub
commit 4d101d8bf6
2 changed files with 37 additions and 0 deletions

View File

@ -15,6 +15,7 @@ import {BackgroundMode} from './plugins/backgroundmode';
import {BarcodeScanner} from './plugins/barcodescanner';
import {Base64ToGallery} from './plugins/base64togallery';
import {BatteryStatus} from './plugins/batterystatus';
import {Brightness} from './plugins/brightness';
import {BLE} from './plugins/ble';
import {BluetoothSerial} from './plugins/bluetoothserial';
import {Calendar} from './plugins/calendar';
@ -99,6 +100,7 @@ export {
BarcodeScanner,
Base64ToGallery,
BatteryStatus,
Brightness,
BLE,
BluetoothSerial,
Clipboard,
@ -145,6 +147,7 @@ window['IonicNative'] = {
BarcodeScanner: BarcodeScanner,
Base64ToGallery: Base64ToGallery,
BatteryStatus: BatteryStatus,
Brightness: Brightness,
BLE: BLE,
BluetoothSerial: BluetoothSerial,
Calendar: Calendar,

34
src/plugins/brightness.ts Normal file
View File

@ -0,0 +1,34 @@
import {Plugin, Cordova} from './plugin';
@Plugin({
plugin: 'cordova-plugin-brightness',
pluginRef: 'plugins.brightness',
repo: 'https://github.com/mgcrea/cordova-plugin-brightness',
platforms: ['Android', 'iOS']
})
export class Brightness {
/**
* Sets the brightness of the display.
*
* @param {value} Floating number between 0 and 1 in which case 1 means 100% brightness and 0 means 0% brightness.
* @returns {Promise} Returns a Promise that resolves if setting brightness was successful.
*/
@Cordova()
static setBrightness(value: number): Promise<any> { return; }
/**
* Reads the current brightness of the device display.
*
* @returns {Promise} Returns a Promise that resolves with the
* brightness value of the device display (floating number between 0 and 1).
*/
@Cordova()
static getBrightness(): Promise<any> { return; }
/**
* Keeps the screen on. Prevents the device from setting the screen to sleep.
*/
@Cordova()
static setKeepScreenOn(value: boolean): void { }
}