chore(): remove returned Promises

Addresses: https://github.com/driftyco/ionic-native/issues/38.
This commit is contained in:
Tim Lancina 2016-03-10 14:54:25 -06:00
parent 738184b5be
commit 78fdbcd42e
5 changed files with 16 additions and 116 deletions

View File

@ -59,26 +59,12 @@ export class ActionSheet {
addCancelButtonWithLabel?: string, addCancelButtonWithLabel?: string,
addDestructiveButtonWithLabel?: string, addDestructiveButtonWithLabel?: string,
position?: number[] position?: number[]
}) { }): Promise<any> { return }
// 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) => {});
}
/** /**
* Hide the ActionSheet. * Hide the ActionSheet.
*/ */
@Cordova() @Cordova()
static hide() { static hide(): Promise<any> { return }
// 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) => {});
}
} }

View File

@ -38,13 +38,6 @@ export class AppAvailability {
* @returns {Promise<boolean>} * @returns {Promise<boolean>}
*/ */
@Cordova() @Cordova()
static check(app : string) : Promise<any> { static check(app: string): Promise<boolean> { return }
// 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) => {});
}
} }

View File

@ -45,9 +45,7 @@ export class AppRate {
* @type {{}} * @type {{}}
*/ */
@CordovaProperty @CordovaProperty
static get preferences() { static get preferences() { return window.AppRate.preferences; }
return window.AppRate.preferences;
}
/** /**
* Prompts the user for rating * Prompts the user for rating
@ -55,6 +53,6 @@ export class AppRate {
* @param {boolean} immediately Show the rating prompt immediately. * @param {boolean} immediately Show the rating prompt immediately.
*/ */
@Cordova() @Cordova()
static promptForRating(immediately: boolean) : void {}; static promptForRating(immediately: boolean): void {};
} }

View File

@ -27,55 +27,27 @@ export class AppVersion {
* @returns {Promise} * @returns {Promise}
*/ */
@Cordova() @Cordova()
static getAppName () { static getAppName(): Promise<any> { return }
// 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) => {});
}
/** /**
* Returns the package name of the app * Returns the package name of the app
* @returns {Promise} * @returns {Promise}
*/ */
@Cordova() @Cordova()
static getPackageName () { static getPackageName(): Promise<any> { return }
// 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) => {});
}
/** /**
* Returns the build identifier of the app * Returns the build identifier of the app
* @returns {Promise} * @returns {Promise}
*/ */
@Cordova() @Cordova()
static getVersionCode () { static getVersionCode(): Promise<any> { return }
// 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) => {});
}
/** /**
* Returns the version of the app * Returns the version of the app
* @returns {Promise} * @returns {Promise}
*/ */
@Cordova() @Cordova()
static getVersionNumber() { static getVersionNumber(): Promise<any> { return }
// 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) => {});
}
} }

View File

@ -26,14 +26,7 @@ export class Badge {
* Clear the badge of the app icon. * Clear the badge of the app icon.
*/ */
@Cordova() @Cordova()
static clear() { static clear(): Promise<boolean> { return }
// 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) => {});
}
/** /**
* Set the badge of the app icon. * Set the badge of the app icon.
@ -41,28 +34,14 @@ export class Badge {
* @returns {Promise} * @returns {Promise}
*/ */
@Cordova() @Cordova()
static set(number: number) { static set(number: number): Promise<any> { return }
// 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) => {});
}
/** /**
* Get the badge of the app icon. * Get the badge of the app icon.
* @returns {Promise} * @returns {Promise}
*/ */
@Cordova() @Cordova()
static get() { static get(): Promise<any> { return }
// 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) => {});
}
/** /**
* Increase the badge number. * Increase the badge number.
@ -70,14 +49,7 @@ export class Badge {
* @returns {Promise} * @returns {Promise}
*/ */
@Cordova() @Cordova()
static increase(number: number) { static increase(number: number): Promise<any> { return }
// 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) => {});
}
/** /**
* Decrease the badge number. * Decrease the badge number.
@ -85,39 +57,18 @@ export class Badge {
* @returns {Promise} * @returns {Promise}
*/ */
@Cordova() @Cordova()
static decrease(number: number) { static decrease(number: number): Promise<any> { return }
// 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) => {});
}
/** /**
* Determine if the app has permission to show badges. * Determine if the app has permission to show badges.
*/ */
@Cordova() @Cordova()
static hasPermission() { static hasPermission(): Promise<any> { return }
// 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) => {});
}
/** /**
* Register permission to set badge notifications * Register permission to set badge notifications
* @returns {Promise} * @returns {Promise}
*/ */
@Cordova() @Cordova()
static registerPermission() { static registerPermission(): Promise<any> { return }
// 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) => {});
}
} }