mirror of
https://github.com/danielsogl/awesome-cordova-plugins.git
synced 2025-04-22 18:46:26 +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 {Hotspot} from './plugins/hotspot';
|
||||||
import {ImagePicker} from './plugins/imagepicker';
|
import {ImagePicker} from './plugins/imagepicker';
|
||||||
import {InAppBrowser} from './plugins/inappbrowser';
|
import {InAppBrowser} from './plugins/inappbrowser';
|
||||||
|
import {Insomnia} from './plugins/insomnia';
|
||||||
import {Keyboard} from './plugins/keyboard';
|
import {Keyboard} from './plugins/keyboard';
|
||||||
import {LaunchNavigator} from './plugins/launchnavigator';
|
import {LaunchNavigator} from './plugins/launchnavigator';
|
||||||
import {LocalNotifications} from './plugins/localnotifications';
|
import {LocalNotifications} from './plugins/localnotifications';
|
||||||
@ -93,6 +94,7 @@ export {
|
|||||||
Hotspot,
|
Hotspot,
|
||||||
ImagePicker,
|
ImagePicker,
|
||||||
InAppBrowser,
|
InAppBrowser,
|
||||||
|
Insomnia,
|
||||||
Keyboard,
|
Keyboard,
|
||||||
LaunchNavigator,
|
LaunchNavigator,
|
||||||
LocalNotifications,
|
LocalNotifications,
|
||||||
@ -104,7 +106,7 @@ export {
|
|||||||
SocialSharing,
|
SocialSharing,
|
||||||
SpinnerDialog,
|
SpinnerDialog,
|
||||||
Splashscreen,
|
Splashscreen,
|
||||||
SQLite,
|
SQLite,
|
||||||
StatusBar,
|
StatusBar,
|
||||||
Toast,
|
Toast,
|
||||||
TouchID,
|
TouchID,
|
||||||
@ -146,7 +148,7 @@ window['IonicNative'] = {
|
|||||||
Flashlight: Flashlight,
|
Flashlight: Flashlight,
|
||||||
Geolocation: Geolocation,
|
Geolocation: Geolocation,
|
||||||
Globalization: Globalization,
|
Globalization: Globalization,
|
||||||
GoogleMaps : GoogleMaps,
|
GoogleMaps : GoogleMaps,
|
||||||
GoogleAnalytics: GoogleAnalytics,
|
GoogleAnalytics: GoogleAnalytics,
|
||||||
Hotspot: Hotspot,
|
Hotspot: Hotspot,
|
||||||
ImagePicker: ImagePicker,
|
ImagePicker: ImagePicker,
|
||||||
@ -162,7 +164,7 @@ window['IonicNative'] = {
|
|||||||
SocialSharing: SocialSharing,
|
SocialSharing: SocialSharing,
|
||||||
SpinnerDialog: SpinnerDialog,
|
SpinnerDialog: SpinnerDialog,
|
||||||
Splashscreen: Splashscreen,
|
Splashscreen: Splashscreen,
|
||||||
SQLite: SQLite,
|
SQLite: SQLite,
|
||||||
StatusBar: StatusBar,
|
StatusBar: StatusBar,
|
||||||
Toast: Toast,
|
Toast: Toast,
|
||||||
TouchID: TouchID,
|
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…
x
Reference in New Issue
Block a user