import {Plugin, Cordova} from './plugin'; /** * @name Background Mode * @description * Cordova plugin to prevent the app from going to sleep while in background. * For more info about plugin, vist: https://github.com/katzer/cordova-plugin-background-mode#android-customization */ @Plugin({ plugin: 'cordova-plugin-background-mode', pluginRef: 'cordova.plugin.background-mode', repo: 'https://github.com/katzer/cordova-plugin-background-mode', platforms: ['Android', 'iOS', 'Windows Phone 8'] }) export class BackgroundMode { /** * Enable the background mode. * Once called, prevents the app from being puased while in background. */ @Cordova({ sync: true }) static enable(): void{} /** * Disable the background mode. * Once the background mode has been disabled, the app will be paused when in background. */ @Cordova() static disable(): void{} /** * Checks if background mode is enabled or not. */ @Cordova() static isEnabled(): Promise {return; } /** * Can be used to get the information if the background mode is active. */ @Cordova() static isActive(): Promise {return; } /** * Override the default title, ticker and text. * Available only for Android platform. */ @Cordova() static setDefaults(options?:Defaults):void{} /** * Modify the displayed information. * Available only for Android platform. */ @Cordova() static update(options?:Configure):void{} /** * Sets a callback for a specific event * Can be used to get notified or run function when the background mode has been activated, deactivated or failed. * @param eventName The name of the event. Available events: activate, deactivate, failure */ @Cordova({ sync: true }) static on(eventName: string, callback: any): void {} } /** *Default configurations avaialable only on Android */ export interface Defaults{ /** *Title of the background task */ title?: String; /** *The text that scrolls itself on statusbar */ ticker?: String; /** *Description of background task */ text?: String; } /** * Configurations items that can be updated. */ export interface Configure{ /** *Title of the background task */ title?: String; /** *The text that scrolls itself on statusbar */ ticker?: String; /** *Description of background task */ text?: String; /** *Boolean, if true plugin will not display a notification. Default is false. */ silent?:boolean; }