chore(): cleanup return values

Addresses https://github.com/driftyco/ionic-native/issues/38.
This commit is contained in:
Tim Lancina 2016-03-10 15:48:20 -06:00
parent 78fdbcd42e
commit 998a58e036
21 changed files with 141 additions and 611 deletions

View File

@ -28,14 +28,7 @@ export class BarcodeScanner {
* @return Returns a Promise that resolves with scanner data, or rejects with an error.
*/
@Cordova()
static scan(){
// 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 scan(): Promise<any> { return }
// Not well supported
// @Cordova()

View File

@ -181,14 +181,7 @@ export class BLE {
@Cordova({
observable: true
})
static scan(services:string[], seconds:number) {
// This Observable 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 Observable, 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 Observable<any>(observer => {});
}
static scan(services: string[], seconds: number): Observable<any> { return }
/**
* Scan and discover BLE peripherals until `stopScan` is called.
@ -211,14 +204,7 @@ export class BLE {
clearFunction: 'stopScan',
clearWithArgs: true
})
static startScan(services:string[]){
// This Observable 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 Observable, 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 Observable<any>(observer => {});
};
static startScan(services: string[]): Observable<any> { return }
/**
* Stop a scan started by `startScan`.
@ -235,14 +221,7 @@ export class BLE {
* @return returns a Promise.
*/
@Cordova()
static stopScan(){
// 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 stopScan(): Promise<any> { return }
/**
* Connect to a peripheral.
@ -263,14 +242,7 @@ export class BLE {
clearFunction: 'disconnect',
clearWithArgs: true
})
static connect(deviceId:string){
// This Observable 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 Observable, 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 Observable<any>(observer => {});
};
static connect(deviceId: string): Observable<any> { return }
/**
* Disconnect from a peripheral.
@ -284,14 +256,7 @@ export class BLE {
* @return Returns a Promise
*/
@Cordova()
static disconnect(deviceId:string) {
// 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 disconnect(deviceId: string): Promise<any> { return }
/**
* Read the value of a characteristic.
@ -302,14 +267,11 @@ export class BLE {
* @return Returns a Promise
*/
@Cordova()
static read(deviceId:string, serviceUUID:string, characteristicUUID:string){
// 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 read(
deviceId: string,
serviceUUID: string,
characteristicUUID: string
): Promise<any> { return };
/**
* Write the value of a characteristic.
@ -340,14 +302,12 @@ export class BLE {
* @return Returns a Promise
*/
@Cordova()
static write(deviceId:string, serviceUUID:string, characteristicUUID:string, value:ArrayBuffer){
// 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 write(
deviceId: string,
serviceUUID: string,
characteristicUUID: string,
value: ArrayBuffer
): Promise<any> { return }
/**
* Write the value of a characteristic without waiting for confirmation from the peripheral.
@ -359,14 +319,12 @@ export class BLE {
* @return Returns a Promise
*/
@Cordova()
static writeWithoutResponse(deviceId:string, serviceUUID:string, characteristicUUID:string, value:ArrayBuffer){
// 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 writeWithoutResponse(
deviceId: string,
serviceUUID: string,
characteristicUUID: string,
value: ArrayBuffer
): Promise<any> { return }
/**
* Register to be notified when the value of a characteristic changes.
@ -388,14 +346,11 @@ export class BLE {
clearFunction: 'stopNotification',
clearWithArgs: true
})
static startNotification(deviceId:string, serviceUUID:string, characteristicUUID:string){
// This Observable 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 Observable, 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 Observable<any>(observer => {});
};
static startNotification(
deviceId: string,
serviceUUID: string,
characteristicUUID: string
): Observable<any> { return }
/**
* Stop being notified when the value of a characteristic changes.
@ -406,14 +361,11 @@ export class BLE {
* @return Returns a Promise.
*/
@Cordova()
static stopNotification(deviceId:string, serviceUUID:string, characteristicUUID:string){
// 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 stopNotification(
deviceId: string,
serviceUUID: string,
characteristicUUID: string
): Promise<any> { return }
/**
* Report the connection status.
@ -429,14 +381,7 @@ export class BLE {
* @return Returns a Promise.
*/
@Cordova()
static isConnected(deviceId:string){
// 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 isConnected(deviceId: string): Promise<any> { return }
/**
* Report if bluetooth is enabled.
@ -451,14 +396,7 @@ export class BLE {
* @return Returns a Promise.
*/
@Cordova()
static isEnabled(){
// 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 isEnabled(): Promise<any> { return }
/**
* Open System Bluetooth settings (Android only).
@ -466,14 +404,7 @@ export class BLE {
* @return Returns a Promise.
*/
@Cordova()
static showBluetoothSettings(){
// 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 showBluetoothSettings(): Promise<any> { return }
/**
* Enable Bluetooth on the device (Android only).
@ -481,12 +412,5 @@ export class BLE {
* @return Returns a Promise.
*/
@Cordova()
static enable(){
// 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 enable(): Promise<any> { return }
}

View File

@ -48,14 +48,9 @@ export class Calendar {
* @return Returns a Promise
*/
@Cordova()
static createCalendar(nameOrOptions: string | { calendarName: string, calendarColor: string }) {
// 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 createCalendar(
nameOrOptions: string | { calendarName: string, calendarColor: string }
): Promise<any> { return }
/**
* Delete a calendar. (iOS only)
@ -72,14 +67,7 @@ export class Calendar {
* @return Returns a Promise
*/
@Cordova()
static deleteCalendar(name: string) {
// 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 deleteCalendar(name: string): Promise<any> { return }
/**
* Returns the default calendar options.
@ -127,14 +115,7 @@ export class Calendar {
notes?: string,
startDate?: Date,
endDate?: Date
) {
// 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 }
/**
* Silently create an event with additional options.
@ -155,14 +136,7 @@ export class Calendar {
startDate?: Date,
endDate?: Date,
options?: CalendarOptions
) {
// 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 }
/**
* Interactively create an event.
@ -181,14 +155,7 @@ export class Calendar {
notes?: string,
startDate?: Date,
endDate?: Date
) {
// 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 }
/**
* Interactively create an event with additional options.
@ -209,14 +176,7 @@ export class Calendar {
startDate?: Date,
endDate?: Date,
options?: CalendarOptions
) {
// 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 }
// deprecated
// @Cordova()
@ -246,14 +206,7 @@ export class Calendar {
notes?: string,
startDate?: Date,
endDate?: Date
) {
// 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 }
/**
* Find an event with additional options.
@ -274,14 +227,7 @@ export class Calendar {
startDate?: Date,
endDate?: Date,
options?: CalendarOptions
) {
// 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 }
/**
* Find a list of events within the specified date range. (Android only)
@ -291,37 +237,21 @@ export class Calendar {
* @return Returns a Promise that resolves with the list of events, or rejects with an error.
*/
@Cordova()
static listEventsInRange(startDate: Date, endDate: Date) {
// 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 listEventsInRange(startDate: Date, endDate: Date): Promise<any> { return }
/**
* Get a list of all calendars.
* @return A Promise that resolves with the list of calendars, or rejects with an error.
*/
@Cordova()
static listCalendars(){
return new Promise<any>((res, rej) => {});
}
static listCalendars(){ return }
/**
* Get a list of all future events in the specified calendar. (iOS only)
* @return Returns a Promise that resolves with the list of events, or rejects with an error.
*/
@Cordova()
static findAllEventsInNamedCalendar(calendarName: string) {
// 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 findAllEventsInNamedCalendar(calendarName: string): Promise<any> { return }
/**
* Modify an event. (iOS only)
@ -350,14 +280,7 @@ export class Calendar {
newNotes?: string,
newStartDate?: Date,
newEndDate?: Date
) {
// 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 }
/**
* Modify an event with additional options. (iOS only)
@ -388,14 +311,7 @@ export class Calendar {
newStartDate?: Date,
newEndDate?: Date,
options?: CalendarOptions
) {
// 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) => {});
}
) { return }
/**
* Delete an event.
@ -414,14 +330,7 @@ export class Calendar {
notes?: string,
startDate?: Date,
endDate?: Date
) {
// 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 }
/**
* Delete an event from the specified Calendar. (iOS only)
@ -442,26 +351,12 @@ export class Calendar {
startDate?: Date,
endDate?: Date,
calendarName?: string
) {
// 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 }
/**
* Open the calendar at the specified date.
* @return {Date} date
*/
@Cordova()
static openCalendar(date: Date) {
// 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 openCalendar(date: Date): Promise<any> { return }
}

View File

@ -115,14 +115,7 @@ export class Camera {
@Cordova({
callbackOrder: 'reverse'
})
static getPicture(options: CameraOptions){
// 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 getPicture(options: CameraOptions): Promise<any> { return }
/**
* Remove intermediate image files that are kept in temporary storage after calling camera.getPicture.

View File

@ -37,17 +37,13 @@ export class Clipboard {
* @returns {Promise<T>}
*/
@Cordova()
static copy(text : string) : Promise<any> {
return new Promise((res, resj) => {});
}
static copy(text: string): Promise<any> { return }
/**
* Pastes the text stored in clipboard
* @returns {Promise<T>}
*/
@Cordova()
static paste() : Promise<any> {
return new Promise((res, rej) => {});
}
static paste(): Promise<any> { return }
}

View File

@ -246,26 +246,13 @@ export class Contacts {
successIndex: 1,
errorIndex: 2
})
static find(fields: string[], options?: 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<Contact[]>((res, rej) => {});
};
static find(fields: string[], options?: any): Promise<any> { return }
/**
* Select a single Contact.
* @return Returns a Promise that resolves with the selected Contact
*/
@Cordova()
static pickContact(){
// 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<Contact>((res, rej) => {});
};
static pickContact(): Promise<any> { return }
}

View File

@ -99,13 +99,6 @@ export class DatePicker {
* @returns {Promise<Date>} Returns a promise that resolves with the picked date and/or time, or rejects with an error.
*/
@Cordova()
static show(options: datePickerOptions): Promise<Date> {
// 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<Date>((res, rej) => {});
}
static show(options: datePickerOptions): Promise<Date> { return }
}

View File

@ -50,7 +50,5 @@ export class Device {
* @returns {Object} The device object.
*/
@CordovaProperty
static get device() {
return window.device;
}
static get device() { return window.device; }
}

View File

@ -72,14 +72,7 @@ export class DeviceMotion {
* @returns {Promise<any>} Returns object with x, y, z, and timestamp properties
*/
@Cordova()
static getCurrentAcceleration () : Promise<accelerationData> {
// 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<accelerationData>((res, rej) => {});
}
static getCurrentAcceleration(): Promise<accelerationData> { return }
/**
* Watch the device acceleration. Clear the watch by unsubscribing from the observable.
@ -101,12 +94,5 @@ export class DeviceMotion {
observable: true,
clearFunction: 'clearWatch'
})
static watchAcceleration (options? : accelerometerOptions) : Observable<accelerationData> {
// This Observable 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 PrObservableomise, 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 Observable<accelerationData>(observer => {});
}
static watchAcceleration (options?: accelerometerOptions): Observable<accelerationData> { return }
}

View File

@ -74,14 +74,7 @@ export class DeviceOrientation {
* @returns {Promise<CompassHeading>}
*/
@Cordova()
static getCurrentHeading() : Promise<CompassHeading> {
// 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<CompassHeading>((res, rej) => {});
}
static getCurrentHeading(): Promise<CompassHeading> { return }
/**
* Get the device current heading at a regular interval
@ -95,13 +88,6 @@ export class DeviceOrientation {
observable: true,
cancelFunction: 'clearWatch'
})
static watchHeading(options? : CompassOptions) : Observable<CompassHeading> {
// This Observable 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 Observable, 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 Observable<CompassHeading>(observer => {});
}
static watchHeading(options?: CompassOptions): Observable<CompassHeading> { return }
}

View File

@ -42,14 +42,11 @@ export class Dialogs {
successIndex: 1,
errorIndex: 4
})
static alert(message, title : string = 'Alert', buttonName : string = 'OK') : 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<any>((res, rej) => {});
}
static alert(
message,
title: string = 'Alert',
buttonName: string = 'OK'
): Promise<any>{ return }
/**
* Displays a customizable confirmation dialog box.
@ -62,14 +59,11 @@ export class Dialogs {
successIndex: 1,
errorIndex: 4
})
static confirm(message, title : string = 'Confirm', buttonLabels : Array<string> = ['OK', 'Cancel']) : Promise<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<number>((res, rej) => {});
}
static confirm(
message,
title: string = 'Confirm',
buttonLabels: Array<string> = ['OK', 'Cancel']
): Promise<number>{ return }
/**
* Displays a native dialog box that is more customizable than the browser's prompt function.
@ -83,14 +77,12 @@ export class Dialogs {
successIndex: 1,
errorIndex: 5
})
static prompt(message, title : string = 'Prompt', buttonLabels : Array<string> = ['OK', 'Cancel'], defaultText : 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<any>((res, rej) => {});
}
static prompt(
message?: string,
title: string = 'Prompt',
buttonLabels: Array<string> = ['OK', 'Cancel'],
defaultText: string = ''
): Promise<any>{ return }
/**
@ -100,6 +92,6 @@ export class Dialogs {
@Cordova({
sync: true
})
static beep(times : number) : void {}
static beep(times: number): void {}
}

View File

@ -102,14 +102,7 @@ export class Facebook {
* @return Returns a Promise that resolves with a status object if login succeeds, and rejects if login fails.
*/
@Cordova()
static login(permissions: string[]){
// 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 login(permissions: string[]): Promise<any> { return }
/**
* Logout of Facebook.
@ -118,14 +111,7 @@ export class Facebook {
* @return Returns a Promise that resolves on a successful logout, and rejects if logout fails.
*/
@Cordova()
static logout(){
// 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 logout(): Promise<any> { return }
/**
* Determine if a user is logged in to Facebook and has authenticated your app. There are three possible states for a user:
@ -154,14 +140,7 @@ export class Facebook {
* @return Returns a Promise that resolves with a status, or rejects with an error
*/
@Cordova()
static getLoginStatus(){
// 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 getLoginStatus(): Promise<any> { return }
/**
* Get a Facebook access token for using Facebook services.
@ -169,14 +148,7 @@ export class Facebook {
* @return Returns a Promise that resolves with an access token, or rejects with an error
*/
@Cordova()
static getAccessToken(){
// 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<string>((res, rej) => {});
}
static getAccessToken(): Promise<string> { return }
/**
* Show one of various Facebook dialogs. Example of options for a Share dialog:
@ -196,14 +168,7 @@ export class Facebook {
* @return Returns a Promise that resolves with success data, or rejects with an error
*/
@Cordova()
static showDialog(options: 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<any>((res, rej) => {});
}
static showDialog(options: any): Promise<any> { return }
/**
* Make a call to Facebook Graph API. Can take additional permissions beyond those granted on login.
@ -219,14 +184,7 @@ export class Facebook {
* @return Returns a Promise that resolves with the result of the request, or rejects with an error
*/
@Cordova()
static api(requestPath: string, permissions: string[]){
// 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 api(requestPath: string, permissions: string[]): Promise<any> { return }
/**
* Log an event. For more information see the Events section above.
@ -237,14 +195,11 @@ export class Facebook {
* @return
*/
@Cordova()
static logEvent(name: string, params?: Object, valueToSum?: 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 logEvent(
name: string,
params?: Object,
valueToSum?: number
): Promise<any> { return }
/**
* Log a purchase. For more information see the Events section above.
@ -254,14 +209,7 @@ export class Facebook {
* @return Returns a Promise
*/
@Cordova()
static logPurchase(value: number, currency: string){
// 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 logPurchase(value: number, currency: string): Promise<any> { return }
/**
* Open App Invite dialog. Does not require login.
@ -282,12 +230,5 @@ export class Facebook {
static appInvite(options: {
url: string,
picture: string
}){
// 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 }
}

View File

@ -22,60 +22,28 @@ export class Flashlight {
* @returns {Promise<boolean>} Returns a promise that resolves with a boolean stating if the flash light is available.
*/
@Cordova()
static available() : Promise<boolean>{
// 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 available(): Promise<boolean> { return }
/**
* Switches the flashlight on
* @returns {Promise<boolean>}
*/
@Cordova()
static switchOn() : Promise<boolean>{
// 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 switchOn(): Promise<boolean> { return }
/**
* Switches the flash light off
* @returns {Promise<boolean>}
*/
@Cordova()
static switchOff() : Promise<boolean>{
// 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 switchOff(): Promise<boolean> { return }
/**
* Toggles the flashlight
* @returns {Promise<any>}
*/
@Cordova()
static toggle() : 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<any>((res,rej)=>{});
}
static toggle(): Promise<any> { return }
/**
@ -85,9 +53,6 @@ export class Flashlight {
@Cordova({
sync: true
})
static isSwitchedOn() : boolean {
// DUMMY BOOLEAN, @Cordova decorator will replace value.
return true;
}
static isSwitchedOn(): boolean { return }
}

View File

@ -128,14 +128,7 @@ export class Geolocation {
@Cordova({
callbackOrder: 'reverse'
})
static getCurrentPosition(options?: GeolocationOptions){
// 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<Geoposition>((res, rej) => {});
}
static getCurrentPosition(options?: GeolocationOptions): Promise<Geoposition> { return }
/**
* Watch the current device's position. Clear the watch by unsubscribing from
@ -158,12 +151,5 @@ export class Geolocation {
observable: true,
clearFunction: 'clearWatch'
})
static watchPosition(options?: GeolocationOptions){
// This Observable 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 Observable, 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 Observable<Geoposition>(observer => {});
};
static watchPosition(options?: GeolocationOptions): Observable<Geoposition> { return }
}

View File

@ -50,12 +50,5 @@ export class ImagePicker {
@Cordova({
callbackOrder: 'reverse'
})
static getPictures(options: ImagePickerOptions) {
// 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 getPictures(options: ImagePickerOptions): Promise<any> { return }
}

View File

@ -80,13 +80,10 @@ export class LaunchNavigator {
successIndex: 2,
errorIndex: 3
})
static navigate(destination : any, start : any, options? : launchNavigatorOptions) : 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<any>((res, rej) => {});
}
static navigate(
destination: any,
start: any,
options?: launchNavigatorOptions
): Promise<any> { return }
}

View File

@ -285,21 +285,13 @@ export class Push {
@Cordova({
sync: true
})
static init(options: PushOptions){
return new PushNotification();
}
static init(options: PushOptions): PushNotification { return }
/**
* Check whether the push notification permission has been granted.
* @return {Promise} Returns a Promise that resolves with an object with one property: isEnabled, a boolean that indicates if permission has been granted.
*/
@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<{ isEnabled: boolean }>((res, rej) => {});
}
static hasPermission(): Promise<{ isEnabled: boolean }> { return }
}

View File

@ -51,13 +51,10 @@ export class SMS {
* @returns {Promise<any>}
*/
@Cordova()
static send(number : any, message : string, options? : smsOptions) : 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<any>((res, rej) => {});
}
static send(
number: string | string[],
message: string,
options?: smsOptions
): Promise<any> { return }
}

View File

@ -102,7 +102,5 @@ export class StatusBar {
* Whether the StatusBar is currently visible or not.
*/
@CordovaProperty
static get isVisible() {
return window.StatusBar.isVisible;
}
static get isVisible() { return window.StatusBar.isVisible; }
}

View File

@ -31,28 +31,18 @@ export class Toast {
observable: true,
clearFunction: 'hide'
})
static show(message: string, duration: string, position: string){
// This Observable 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 Observable, 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 Observable<any>(observer => {});
}
static show(
message: string,
duration: string,
position: string
): Observable<any> { return }
/**
* Manually hide any currently visible toast.
* @return {Promise} Returns a Promise that resolves on success.
*/
@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 }
/**
* Show a native toast with the given options.
@ -69,14 +59,7 @@ export class Toast {
observable: true,
clearFunction: 'hide'
})
static showWithOptions(options: ToastOptions){
// This Observable 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 Observable, 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 Observable<any>(observer => {});
}
static showWithOptions(options: ToastOptions): Observable<any> { return }
/**
* Shorthand for `show(message, 'short', 'top')`.
@ -86,14 +69,7 @@ export class Toast {
observable: true,
clearFunction: 'hide'
})
static showShortTop(message: string){
// This Observable 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 Observable, 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 Observable<any>(observer => {});
}
static showShortTop(message: string): Observable<any> { return }
/**
* Shorthand for `show(message, 'short', 'center')`.
@ -103,14 +79,8 @@ export class Toast {
observable: true,
clearFunction: 'hide'
})
static showShortCenter(message: string){
// This Observable 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 Observable, 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 Observable<any>(observer => {});
}
static showShortCenter(message: string): Observable<any> { return }
/**
* Shorthand for `show(message, 'short', 'bottom')`.
@ -120,14 +90,8 @@ export class Toast {
observable: true,
clearFunction: 'hide'
})
static showShortBottom(message: string){
// This Observable 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 Observable, 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 Observable<any>(observer => {});
}
static showShortBottom(message: string): Observable<any> { return }
/**
* Shorthand for `show(message, 'long', 'top')`.
@ -137,14 +101,8 @@ export class Toast {
observable: true,
clearFunction: 'hide'
})
static showLongTop(message: string){
// This Observable 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 Observable, 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 Observable<any>(observer => {});
}
static showLongTop(message: string): Observable<any> { return }
/**
* Shorthand for `show(message, 'long', 'center')`.
@ -154,14 +112,8 @@ export class Toast {
observable: true,
clearFunction: 'hide'
})
static showLongCenter(message: string){
// This Observable 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 Observable, 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 Observable<any>(observer => {});
}
static showLongCenter(message: string): Observable<any> { return }
/**
* Shorthand for `show(message, 'long', 'bottom')`.
@ -171,12 +123,6 @@ export class Toast {
observable: true,
clearFunction: 'hide'
})
static showLongBottom(message: string){
// This Observable 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 Observable, 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 Observable<any>(observer => {});
}
static showLongBottom(message: string): Observable<any> { return }
}

View File

@ -34,14 +34,7 @@ export class TouchID {
* @return {Promise} Returns a Promise that resolves if yes, rejects if no.
*/
@Cordova()
isAvailable() {
// 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) => {});
};
isAvailable(): Promise<any>{ return }
/**
* Show TouchID dialog and wait for a fingerprint scan. If user taps 'Enter Password' button, brings up standard system passcode screen.
@ -50,14 +43,7 @@ export class TouchID {
* @return {Promise} Returns a Promise the resolves if the fingerprint scan was successful, rejects with an error code (see above).
*/
@Cordova()
static verifyFingerprint(message: string) {
// 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 verifyFingerprint(message: string): Promise<any>{ return }
/**
* Show TouchID dialog and wait for a fingerprint scan. If user taps 'Enter Password' button, rejects with code '-3' (see above).
@ -66,14 +52,7 @@ export class TouchID {
* @return {Promise} Returns a Promise the resolves if the fingerprint scan was successful, rejects with an error code (see above).
*/
@Cordova()
static verifyFingerprintWithCustomPasswordFallback(message: string) {
// 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 verifyFingerprintWithCustomPasswordFallback(message: string): Promise<any> { return }
/**
* Show TouchID dialog with custom 'Enter Password' message and wait for a fingerprint scan. If user taps 'Enter Password' button, rejects with code '-3' (see above).
@ -83,12 +62,5 @@ export class TouchID {
* @return {Promise} Returns a Promise the resolves if the fingerprint scan was successful, rejects with an error code (see above).
*/
@Cordova()
static verifyFingerprintWithCustomPasswordFallbackAndEnterPasswordLabel(message: string, enterPasswordLabel: string) {
// 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 verifyFingerprintWithCustomPasswordFallbackAndEnterPasswordLabel(message: string, enterPasswordLabel: string): Promise<any> { return }
}