mirror of
https://github.com/danielsogl/awesome-cordova-plugins.git
synced 2025-01-20 01:22:52 +08:00
Merge pull request #157 from matiastucci/master
implement wrappers for Insomnia
This commit is contained in:
commit
87751ca277
@ -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
47
src/plugins/insomnia.ts
Normal 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; }
|
||||
}
|
Loading…
Reference in New Issue
Block a user