2017-03-20 16:38:14 -04:00
|
|
|
import { Injectable } from '@angular/core';
|
2017-12-28 07:28:44 -05:00
|
|
|
import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core';
|
2017-03-20 16:38:14 -04:00
|
|
|
|
2017-01-21 05:14:29 +08:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @beta
|
|
|
|
|
* @name Backlight
|
|
|
|
|
* @description
|
|
|
|
|
* This plugin adds turning on/off the device backlight.
|
|
|
|
|
*
|
|
|
|
|
* @usage
|
2017-04-30 20:36:22 +02:00
|
|
|
* ```typescript
|
2018-10-10 16:13:45 -05:00
|
|
|
* import { Backlight } from '@ionic-native/backlight/ngx';
|
2017-03-20 16:38:14 -04:00
|
|
|
*
|
|
|
|
|
* constructor(private backlight: Backlight) { }
|
|
|
|
|
*
|
|
|
|
|
* ...
|
2017-01-21 05:14:29 +08:00
|
|
|
*
|
|
|
|
|
* // Turn backlight on
|
2017-03-20 16:38:14 -04:00
|
|
|
* this.backlight.on().then(() => console.log('backlight on'));
|
2017-01-21 05:14:29 +08:00
|
|
|
*
|
|
|
|
|
* // Turn backlight off
|
2017-03-20 16:38:14 -04:00
|
|
|
* this.backlight.off().then(() => console.log('backlight off'));
|
2017-01-21 05:14:29 +08:00
|
|
|
*
|
|
|
|
|
* ```
|
|
|
|
|
*/
|
|
|
|
|
@Plugin({
|
|
|
|
|
pluginName: 'Backlight',
|
|
|
|
|
plugin: 'cordova-plugin-backlight',
|
|
|
|
|
pluginRef: 'cordova.plugins.Backlight',
|
|
|
|
|
repo: 'https://github.com/mebibou/cordova-plugin-backlight',
|
|
|
|
|
platforms: ['Android']
|
|
|
|
|
})
|
2017-03-20 16:38:14 -04:00
|
|
|
@Injectable()
|
2017-04-27 00:36:12 -04:00
|
|
|
export class Backlight extends IonicNativePlugin {
|
2017-01-21 05:14:29 +08:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* This function turns backlight on
|
|
|
|
|
* @return {Promise<any>} Returns a promise that resolves when the backlight is on
|
|
|
|
|
*/
|
|
|
|
|
@Cordova()
|
2017-12-28 07:28:44 -05:00
|
|
|
on(): Promise<any> {
|
|
|
|
|
return;
|
|
|
|
|
}
|
2017-01-21 05:14:29 +08:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* This function turns backlight off
|
|
|
|
|
* @return {Promise<any>} Returns a promise that resolves when the backlight is off
|
|
|
|
|
*/
|
|
|
|
|
@Cordova()
|
2017-12-28 07:28:44 -05:00
|
|
|
off(): Promise<any> {
|
|
|
|
|
return;
|
|
|
|
|
}
|
2017-01-21 05:14:29 +08:00
|
|
|
|
|
|
|
|
}
|