Skip to content

Commit

Permalink
feat(backlight): add Backlight plugin (#973)
Browse files Browse the repository at this point in the history
* feat(backlight): add Backlight plugin

* fix(backlight): set as beta
  • Loading branch information
mebibou authored and ihadeed committed Jan 20, 2017
1 parent 7c30718 commit 1279114
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { AppVersion } from './plugins/appversion';
import { Badge } from './plugins/badge';
import { BackgroundGeolocation } from './plugins/background-geolocation';
import { BackgroundMode } from './plugins/backgroundmode';
import { Backlight } from './plugins/backlight';
import { BarcodeScanner } from './plugins/barcodescanner';
import { Base64ToGallery } from './plugins/base64togallery';
import { BatteryStatus } from './plugins/batterystatus';
Expand Down Expand Up @@ -131,6 +132,7 @@ export * from './plugins/apprate';
export * from './plugins/appversion';
export * from './plugins/background-geolocation';
export * from './plugins/backgroundmode';
export * from './plugins/backlight';
export * from './plugins/badge';
export * from './plugins/barcodescanner';
export * from './plugins/base64togallery';
Expand Down Expand Up @@ -253,6 +255,7 @@ window['IonicNative'] = {
Badge,
BackgroundGeolocation,
BackgroundMode,
Backlight,
BarcodeScanner,
Base64ToGallery,
BatteryStatus,
Expand Down
44 changes: 44 additions & 0 deletions src/plugins/backlight.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import { Plugin, Cordova } from './plugin';

/**
* @beta
* @name Backlight
* @description
* This plugin adds turning on/off the device backlight.
*
* @usage
* ```
* import { Backlight } from 'ionic-native';
*
* // Turn backlight on
* Backlight.on().then(() => console.log('backlight on'));
*
* // Turn backlight off
* Backlight.off().then(() => console.log('backlight off'));
*
* ```
*/
@Plugin({
pluginName: 'Backlight',
plugin: 'cordova-plugin-backlight',
pluginRef: 'cordova.plugins.Backlight',
repo: 'https://github.com/mebibou/cordova-plugin-backlight',
platforms: ['Android']
})
export class Backlight {

/**
* This function turns backlight on
* @return {Promise<any>} Returns a promise that resolves when the backlight is on
*/
@Cordova()
static on(): Promise<any> { return; }

/**
* This function turns backlight off
* @return {Promise<any>} Returns a promise that resolves when the backlight is off
*/
@Cordova()
static off(): Promise<any> { return; }

}

0 comments on commit 1279114

Please sign in to comment.