Merge pull request #157 from matiastucci/master

implement wrappers for Insomnia
This commit is contained in:
Ibrahim Hadeed 2016-05-16 03:16:47 -04:00
commit 87751ca277
2 changed files with 52 additions and 3 deletions

View File

@ -39,6 +39,7 @@ import {GoogleAnalytics} from './plugins/googleanalytics';
import {Hotspot} from './plugins/hotspot';
import {ImagePicker} from './plugins/imagepicker';
import {InAppBrowser} from './plugins/inappbrowser';
import {Insomnia} from './plugins/insomnia';
import {Keyboard} from './plugins/keyboard';
import {LaunchNavigator} from './plugins/launchnavigator';
import {LocalNotifications} from './plugins/localnotifications';
@ -93,6 +94,7 @@ export {
Hotspot,
ImagePicker,
InAppBrowser,
Insomnia,
Keyboard,
LaunchNavigator,
LocalNotifications,
@ -104,7 +106,7 @@ export {
SocialSharing,
SpinnerDialog,
Splashscreen,
SQLite,
SQLite,
StatusBar,
Toast,
TouchID,
@ -146,7 +148,7 @@ window['IonicNative'] = {
Flashlight: Flashlight,
Geolocation: Geolocation,
Globalization: Globalization,
GoogleMaps : GoogleMaps,
GoogleMaps : GoogleMaps,
GoogleAnalytics: GoogleAnalytics,
Hotspot: Hotspot,
ImagePicker: ImagePicker,
@ -162,7 +164,7 @@ window['IonicNative'] = {
SocialSharing: SocialSharing,
SpinnerDialog: SpinnerDialog,
Splashscreen: Splashscreen,
SQLite: SQLite,
SQLite: SQLite,
StatusBar: StatusBar,
Toast: Toast,
TouchID: TouchID,

47
src/plugins/insomnia.ts Normal file
View File

@ -0,0 +1,47 @@
import {Plugin, Cordova} from './plugin';
/**
* @name Insomnia
* @description
* Prevent the screen of the mobile device from falling asleep.
*
* @usage
* ```js
* import {Insomnia} from 'ionic-native';
*
* Insomnia.keepAwake()
* .then(
* () => console.log('success'),
* () => console.log('error')
* );
*
* Insomnia.allowSleepAgain()
* .then(
* () => console.log('success'),
* () => console.log('error')
* );
* ```
*
*/
@Plugin({
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; }
}