mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-07-01 15:50:13 +00:00
Merge pull request #17711 from timbru31/feat/cordova-plugin-badge
feat(cordova-plugin-badge): add typings for cordova-plugin-badge
This commit is contained in:
16
types/cordova-plugin-badge/cordova-plugin-badge-tests.ts
Normal file
16
types/cordova-plugin-badge/cordova-plugin-badge-tests.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
/// <reference types="cordova" />
|
||||
|
||||
function callback(badgeOrGranted: number | boolean) {
|
||||
console.log(badgeOrGranted);
|
||||
}
|
||||
|
||||
window.cordova.plugins.notification.badge.clear();
|
||||
window.cordova.plugins.notification.badge.set(10, callback);
|
||||
window.cordova.plugins.notification.badge.decrease(2, callback);
|
||||
window.cordova.plugins.notification.badge.increase(5, callback);
|
||||
window.cordova.plugins.notification.badge.hasPermission(callback);
|
||||
window.cordova.plugins.notification.badge.requestPermission(callback);
|
||||
window.cordova.plugins.notification.badge.get(callback);
|
||||
window.cordova.plugins.notification.badge.configure({
|
||||
autoClear: true
|
||||
});
|
||||
25
types/cordova-plugin-badge/index.d.ts
vendored
Normal file
25
types/cordova-plugin-badge/index.d.ts
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
// Type definitions for cordova-plugin-badge 0.8
|
||||
// Project: https://github.com/katzer/cordova-plugin-badge
|
||||
// Definitions by: Tim Brust <https://github.com/timbru31>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
interface CordovaPlugins {
|
||||
notification: {
|
||||
badge: CordovaPluginBadge;
|
||||
};
|
||||
}
|
||||
|
||||
interface CordovaPluginBadgeOptions {
|
||||
autoClear: boolean;
|
||||
}
|
||||
|
||||
interface CordovaPluginBadge {
|
||||
clear(callback?: (badge: number) => void, scope?: any): void;
|
||||
set(badge?: number, callback?: (badge: number) => void, scope?: any): void;
|
||||
get(callback?: (badge: number) => void, scope?: any): void;
|
||||
increase(count?: number, callback?: (badge: number) => void, scope?: any): void;
|
||||
decrease(count?: number, callback?: (badge: number) => void, scope?: any): void;
|
||||
hasPermission(callback?: (granted: boolean) => void, scope?: any): void;
|
||||
requestPermission(callback?: (granted: boolean) => void, scope?: any): void;
|
||||
configure(config: CordovaPluginBadgeOptions): CordovaPluginBadgeOptions;
|
||||
}
|
||||
23
types/cordova-plugin-badge/tsconfig.json
Normal file
23
types/cordova-plugin-badge/tsconfig.json
Normal file
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6",
|
||||
"dom"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"cordova-plugin-badge-tests.ts"
|
||||
]
|
||||
}
|
||||
1
types/cordova-plugin-badge/tslint.json
Normal file
1
types/cordova-plugin-badge/tslint.json
Normal file
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user