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

56 lines
1.8 KiB
TypeScript
Raw Normal View History

2015-11-30 06:30:15 +08:00
import {Plugin, Cordova} from './plugin';
@Plugin({
name: 'ActionSheet',
plugin: 'cordova-plugin-actionsheet',
pluginRef: 'plugins.actionsheet',
repo: 'https://github.com/EddyVerbruggen/cordova-plugin-actionsheet'
})
export class ActionSheet {
2016-02-06 09:22:23 +08:00
/**
* Show the ActionSheet.
* @param {options}
* Available options:
* buttonLabels: string[]
* title: string
* androidTheme (Android only): number 1-5
* androidEnableCancelButton (Android only): boolean, default false
* winphoneEnableCancelButton (WP only): boolean, default false
* addCancelButtonWithLabel: string
* addDestructiveButtonWithLabel: string
* position: [x, y] (iPad pass in [x, y] coords of popover)
* @returns {Promise} returns a promise that resolves with a number indicating
* which button was pressed (1 for first, 2 for second).
*/
2015-11-30 09:54:45 +08:00
@Cordova()
2016-02-06 09:22:23 +08:00
static show(options?: {
buttonLabels: string[],
title?: string,
androidTheme?: number,
androidEnableCancelButton?: boolean,
winphoneEnableCancelButton?: boolean,
addCancelButtonWithLabel?: string,
addDestructiveButtonWithLabel?: string,
position?: number[]
}){
// This returned Promise is replaced by one from the @Cordova decorator,
// but since there's no way for TypeScript to know the return type from a
// decorator we provide it. See https://github.com/Microsoft/TypeScript/issues/4881.
return new Promise<any>((s, e) => {});
};
2015-11-30 06:30:15 +08:00
2016-02-06 09:22:23 +08:00
/**
* Hide the ActionSheet.
* @param {options}
*/
2015-11-30 09:54:45 +08:00
@Cordova()
2016-02-06 09:22:23 +08:00
static hide(options:any){
// This returned Promise is replaced by one from the @Cordova decorator,
// but since there's no way for TypeScript to know the return type from a
// decorator we provide it. See https://github.com/Microsoft/TypeScript/issues/4881.
return new Promise<any>((s, e) => {});
};
2015-11-30 06:30:15 +08:00
}