diff --git a/src/index.ts b/src/index.ts index acc5c881d..c0fdeff2a 100644 --- a/src/index.ts +++ b/src/index.ts @@ -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'; @@ -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'; @@ -253,6 +255,7 @@ window['IonicNative'] = { Badge, BackgroundGeolocation, BackgroundMode, + Backlight, BarcodeScanner, Base64ToGallery, BatteryStatus, diff --git a/src/plugins/backlight.ts b/src/plugins/backlight.ts new file mode 100644 index 000000000..ec1c55746 --- /dev/null +++ b/src/plugins/backlight.ts @@ -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} Returns a promise that resolves when the backlight is on + */ + @Cordova() + static on(): Promise { return; } + + /** + * This function turns backlight off + * @return {Promise} Returns a promise that resolves when the backlight is off + */ + @Cordova() + static off(): Promise { return; } + +}