Skip to content

Commit

Permalink
chore(): remove returned Promises
Browse files Browse the repository at this point in the history
Addresses: #38.
  • Loading branch information
tlancina committed Mar 10, 2016
1 parent 738184b commit 78fdbcd
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 116 deletions.
18 changes: 2 additions & 16 deletions src/plugins/actionsheet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,26 +59,12 @@ export class ActionSheet {
addCancelButtonWithLabel?: string,
addDestructiveButtonWithLabel?: string,
position?: number[]
}) {
// This Promise is replaced by one from the @Cordova decorator that wraps
// the plugin's callbacks. We provide a dummy one here so TypeScript
// knows that the correct return type is Promise, because there's no way
// for it to know the return type from a decorator.
// See https://github.com/Microsoft/TypeScript/issues/4881
return new Promise<any>((res, rej) => {});
}
}): Promise<any> { return }


/**
* Hide the ActionSheet.
*/
@Cordova()
static hide() {
// This Promise is replaced by one from the @Cordova decorator that wraps
// the plugin's callbacks. We provide a dummy one here so TypeScript
// knows that the correct return type is Promise, because there's no way
// for it to know the return type from a decorator.
// See https://github.com/Microsoft/TypeScript/issues/4881
return new Promise<any>((res, rej) => {});
}
static hide(): Promise<any> { return }
}
9 changes: 1 addition & 8 deletions src/plugins/appavailability.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,6 @@ export class AppAvailability {
* @returns {Promise<boolean>}
*/
@Cordova()
static check(app : string) : Promise<any> {
// This Promise is replaced by one from the @Cordova decorator that wraps
// the plugin's callbacks. We provide a dummy one here so TypeScript
// knows that the correct return type is Promise, because there's no way
// for it to know the return type from a decorator.
// See https://github.com/Microsoft/TypeScript/issues/4881
return new Promise<boolean>((res, rej) => {});
}
static check(app: string): Promise<boolean> { return }

}
6 changes: 2 additions & 4 deletions src/plugins/apprate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,16 +45,14 @@ export class AppRate {
* @type {{}}
*/
@CordovaProperty
static get preferences() {
return window.AppRate.preferences;
}
static get preferences() { return window.AppRate.preferences; }

/**
* Prompts the user for rating
*
* @param {boolean} immediately Show the rating prompt immediately.
*/
@Cordova()
static promptForRating(immediately: boolean) : void {};
static promptForRating(immediately: boolean): void {};

}
36 changes: 4 additions & 32 deletions src/plugins/appversion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,55 +27,27 @@ export class AppVersion {
* @returns {Promise}
*/
@Cordova()
static getAppName () {
// This Promise is replaced by one from the @Cordova decorator that wraps
// the plugin's callbacks. We provide a dummy one here so TypeScript
// knows that the correct return type is Promise, because there's no way
// for it to know the return type from a decorator.
// See https://github.com/Microsoft/TypeScript/issues/4881
return new Promise<any>((res, rej) => {});
}
static getAppName(): Promise<any> { return }

/**
* Returns the package name of the app
* @returns {Promise}
*/
@Cordova()
static getPackageName () {
// This Promise is replaced by one from the @Cordova decorator that wraps
// the plugin's callbacks. We provide a dummy one here so TypeScript
// knows that the correct return type is Promise, because there's no way
// for it to know the return type from a decorator.
// See https://github.com/Microsoft/TypeScript/issues/4881
return new Promise<any>((res, rej) => {});
}
static getPackageName(): Promise<any> { return }

/**
* Returns the build identifier of the app
* @returns {Promise}
*/
@Cordova()
static getVersionCode () {
// This Promise is replaced by one from the @Cordova decorator that wraps
// the plugin's callbacks. We provide a dummy one here so TypeScript
// knows that the correct return type is Promise, because there's no way
// for it to know the return type from a decorator.
// See https://github.com/Microsoft/TypeScript/issues/4881
return new Promise<any>((res, rej) => {});
}
static getVersionCode(): Promise<any> { return }

/**
* Returns the version of the app
* @returns {Promise}
*/
@Cordova()
static getVersionNumber() {
// This Promise is replaced by one from the @Cordova decorator that wraps
// the plugin's callbacks. We provide a dummy one here so TypeScript
// knows that the correct return type is Promise, because there's no way
// for it to know the return type from a decorator.
// See https://github.com/Microsoft/TypeScript/issues/4881
return new Promise<any>((res, rej) => {});
}
static getVersionNumber(): Promise<any> { return }

}
63 changes: 7 additions & 56 deletions src/plugins/badge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,98 +26,49 @@ export class Badge {
* Clear the badge of the app icon.
*/
@Cordova()
static clear() {
// This Promise is replaced by one from the @Cordova decorator that wraps
// the plugin's callbacks. We provide a dummy one here so TypeScript
// knows that the correct return type is Promise, because there's no way
// for it to know the return type from a decorator.
// See https://github.com/Microsoft/TypeScript/issues/4881
return new Promise<boolean>((res, rej) => {});
}
static clear(): Promise<boolean> { return }

/**
* Set the badge of the app icon.
* @param {number} number The new badge number.
* @returns {Promise}
*/
@Cordova()
static set(number: number) {
// This Promise is replaced by one from the @Cordova decorator that wraps
// the plugin's callbacks. We provide a dummy one here so TypeScript
// knows that the correct return type is Promise, because there's no way
// for it to know the return type from a decorator.
// See https://github.com/Microsoft/TypeScript/issues/4881
return new Promise<any>((res, rej) => {});
}
static set(number: number): Promise<any> { return }

/**
* Get the badge of the app icon.
* @returns {Promise}
*/
@Cordova()
static get() {
// This Promise is replaced by one from the @Cordova decorator that wraps
// the plugin's callbacks. We provide a dummy one here so TypeScript
// knows that the correct return type is Promise, because there's no way
// for it to know the return type from a decorator.
// See https://github.com/Microsoft/TypeScript/issues/4881
return new Promise<any>((res, rej) => {});
}
static get(): Promise<any> { return }

/**
* Increase the badge number.
* @param {number} count Count to add to the current badge number
* @returns {Promise}
*/
@Cordova()
static increase(number: number) {
// This Promise is replaced by one from the @Cordova decorator that wraps
// the plugin's callbacks. We provide a dummy one here so TypeScript
// knows that the correct return type is Promise, because there's no way
// for it to know the return type from a decorator.
// See https://github.com/Microsoft/TypeScript/issues/4881
return new Promise<any>((res, rej) => {});
}
static increase(number: number): Promise<any> { return }

/**
* Decrease the badge number.
* @param {number} count Count to subtract from the current badge number
* @returns {Promise}
*/
@Cordova()
static decrease(number: number) {
// This Promise is replaced by one from the @Cordova decorator that wraps
// the plugin's callbacks. We provide a dummy one here so TypeScript
// knows that the correct return type is Promise, because there's no way
// for it to know the return type from a decorator.
// See https://github.com/Microsoft/TypeScript/issues/4881
return new Promise<any>((res, rej) => {});
}
static decrease(number: number): Promise<any> { return }

/**
* Determine if the app has permission to show badges.
*/
@Cordova()
static hasPermission() {
// This Promise is replaced by one from the @Cordova decorator that wraps
// the plugin's callbacks. We provide a dummy one here so TypeScript
// knows that the correct return type is Promise, because there's no way
// for it to know the return type from a decorator.
// See https://github.com/Microsoft/TypeScript/issues/4881
return new Promise<boolean>((res, rej) => {});
}
static hasPermission(): Promise<any> { return }

/**
* Register permission to set badge notifications
* @returns {Promise}
*/
@Cordova()
static registerPermission() {
// This Promise is replaced by one from the @Cordova decorator that wraps
// the plugin's callbacks. We provide a dummy one here so TypeScript
// knows that the correct return type is Promise, because there's no way
// for it to know the return type from a decorator.
// See https://github.com/Microsoft/TypeScript/issues/4881
return new Promise<any>((res, rej) => {});
}
static registerPermission(): Promise<any> { return }
}

0 comments on commit 78fdbcd

Please sign in to comment.