awesome-cordova-plugins/src/plugins/insomnia.ts

52 lines
1.0 KiB
TypeScript
Raw Normal View History

2016-07-18 01:57:22 +08:00
import { Cordova, Plugin } from './plugin';
2016-05-16 14:34:01 +08:00
/**
* @name Insomnia
* @description
* Prevent the screen of the mobile device from falling asleep.
*
* @usage
* ```typescript
* import { Insomnia } from 'ionic-native';
*
2016-05-16 14:34:01 +08:00
*
* Insomnia.keepAwake()
* .then(
* () => console.log('success'),
* () => console.log('error')
* );
*
* Insomnia.allowSleepAgain()
* .then(
* () => console.log('success'),
* () => console.log('error')
* );
* ```
*
*/
@Plugin({
2016-10-18 09:33:17 +08:00
name: 'Insomnia',
2016-05-16 14:34:01 +08:00
plugin: 'https://github.com/EddyVerbruggen/Insomnia-PhoneGap-Plugin.git',
pluginRef: 'plugins.insomnia',
repo: 'https://github.com/EddyVerbruggen/Insomnia-PhoneGap-Plugin',
platforms: ['Android', 'iOS', 'Windows Phone 8']
})
export class Insomnia {
/**
* Keeps awake the application
* @returns {Promise}
*/
@Cordova()
static keepAwake(): Promise<any> { return; }
/**
* Allows the application to sleep again
* @returns {Promise}
*/
@Cordova()
static allowSleepAgain(): Promise<any> { return; }
2016-07-18 01:57:22 +08:00
2016-05-16 14:34:01 +08:00
}