mirror of
https://github.com/danielsogl/awesome-cordova-plugins.git
synced 2025-02-21 00:23:00 +08:00
chore(): update ActionSheet
This commit is contained in:
parent
b2f136773e
commit
0d57ef8852
@ -1,5 +1,8 @@
|
||||
import {Plugin, Cordova} from './plugin';
|
||||
|
||||
/**
|
||||
* The ActionSheet plugin shows a native list of options the user can choose from.
|
||||
*/
|
||||
@Plugin({
|
||||
name: 'ActionSheet',
|
||||
plugin: 'cordova-plugin-actionsheet',
|
||||
@ -20,8 +23,8 @@ export class ActionSheet {
|
||||
* 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).
|
||||
* @returns {Promise} returns a promise that resolves with the index of the
|
||||
* button pressed (1 based, so 1, 2, 3, etc.)
|
||||
*/
|
||||
@Cordova()
|
||||
static show(options?: {
|
||||
@ -33,23 +36,26 @@ export class ActionSheet {
|
||||
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) => {});
|
||||
}) {
|
||||
// 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.
|
||||
* @param {options}
|
||||
*/
|
||||
@Cordova()
|
||||
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) => {});
|
||||
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) => {});
|
||||
};
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user