awesome-cordova-plugins/src/plugins/badge.ts
2016-07-08 00:35:43 +02:00

78 lines
2.0 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import { Cordova, Plugin } from './plugin';
/**
* @name Badge
* @description
* The essential purpose of badge numbers is to enable an application to inform its users that it has something for them — for example, unread messages — when the application isnt running in the foreground.
*
* Requires Cordova plugin: cordova-plugin-badge. For more info, please see the [Badge plugin docs](https://github.com/katzer/cordova-plugin-badge).
*
* @usage
* ```js
* import {Badge} from 'ionic-native';
*
*
* Badge.set(10);
* Badge.increase();
* Badge.clear();
* ```
*/
@Plugin({
plugin: 'cordova-plugin-badge',
pluginRef: 'cordova.plugins.notification.badge',
repo: 'https://github.com/katzer/cordova-plugin-badge',
platforms: ['Android', 'iOS', 'Browser', 'Windows', 'Amazon FireOS', 'Windows Phone 8']
})
export class Badge {
/**
* Clear the badge of the app icon.
*/
@Cordova()
static clear(): Promise<boolean> { return; }
/**
* Set the badge of the app icon.
* @param {number} badgeNumber The new badge number.
* @returns {Promise}
*/
@Cordova()
static set(badgeNumber: number): Promise<any> { return; }
/**
* Get the badge of the app icon.
* @returns {Promise}
*/
@Cordova()
static get(): Promise<any> { return; }
/**
* Increase the badge number.
* @param {number} increaseBy Count to add to the current badge number
* @returns {Promise}
*/
@Cordova()
static increase(increaseBy: number): Promise<any> { return; }
/**
* Decrease the badge number.
* @param {number} decreaseBy Count to subtract from the current badge number
* @returns {Promise}
*/
@Cordova()
static decrease(decreaseBy: number): Promise<any> { return; }
/**
* Determine if the app has permission to show badges.
*/
@Cordova()
static hasPermission(): Promise<any> { return; }
/**
* Register permission to set badge notifications
* @returns {Promise}
*/
@Cordova()
static registerPermission(): Promise<any> { return; }
}