awesome-cordova-plugins/src/plugins/badge.ts

75 lines
1.9 KiB
TypeScript
Raw Normal View History

2016-02-17 17:36:38 +08:00
import {Plugin, Cordova} from './plugin';
/**
* @name Badge
* @description
2016-02-17 17:36:38 +08:00
* 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.
*
2016-03-05 05:42:21 +08:00
* Requires Cordova plugin: cordova-plugin-badge. For more info, please see the [Badge plugin docs](https://github.com/katzer/cordova-plugin-badge).
2016-02-17 17:36:38 +08:00
*
* @usage
* ```js
2016-03-05 05:42:21 +08:00
* Badge.set(10);
* Badge.increase();
* Badge.clear();
2016-02-17 17:36:38 +08:00
* ```
*/
@Plugin({
plugin: 'cordova-plugin-badge',
2016-03-13 08:08:47 +08:00
pluginRef: 'cordova.plugins.notification.badge',
2016-03-15 01:38:35 +08:00
repo: 'https://github.com/katzer/cordova-plugin-badge',
platforms: ['Android', 'iOS', 'Browser', 'Windows', 'Amazon FireOS', 'Windows Phone 8']
2016-02-17 17:36:38 +08:00
})
export class Badge {
/**
2016-03-05 05:42:21 +08:00
* Clear the badge of the app icon.
2016-02-17 17:36:38 +08:00
*/
@Cordova()
static clear(): Promise<boolean> { return }
2016-02-17 17:36:38 +08:00
/**
2016-03-05 05:42:21 +08:00
* Set the badge of the app icon.
* @param {number} number The new badge number.
* @returns {Promise}
2016-02-17 17:36:38 +08:00
*/
@Cordova()
static set(number: number): Promise<any> { return }
2016-02-17 17:36:38 +08:00
/**
2016-03-05 05:42:21 +08:00
* Get the badge of the app icon.
* @returns {Promise}
2016-02-17 17:36:38 +08:00
*/
@Cordova()
static get(): Promise<any> { return }
2016-02-17 17:36:38 +08:00
/**
2016-03-05 05:42:21 +08:00
* Increase the badge number.
* @param {number} count Count to add to the current badge number
* @returns {Promise}
2016-02-17 17:36:38 +08:00
*/
@Cordova()
static increase(number: number): Promise<any> { return }
2016-02-17 17:36:38 +08:00
/**
2016-03-05 05:42:21 +08:00
* Decrease the badge number.
* @param {number} count Count to subtract from the current badge number
* @returns {Promise}
2016-02-17 17:36:38 +08:00
*/
@Cordova()
static decrease(number: number): Promise<any> { return }
2016-02-17 17:36:38 +08:00
/**
2016-03-05 05:42:21 +08:00
* Determine if the app has permission to show badges.
2016-02-17 17:36:38 +08:00
*/
@Cordova()
static hasPermission(): Promise<any> { return }
2016-02-17 17:36:38 +08:00
2016-03-05 05:42:21 +08:00
/**
* Register permission to set badge notifications
* @returns {Promise}
*/
@Cordova()
static registerPermission(): Promise<any> { return }
2016-02-17 17:36:38 +08:00
}