mirror of
https://github.com/danielsogl/awesome-cordova-plugins.git
synced 2025-04-25 04:16:09 +08:00
chore(): update ActionSheet
This commit is contained in:
parent
b2f136773e
commit
0d57ef8852
@ -1,5 +1,8 @@
|
|||||||
import {Plugin, Cordova} from './plugin';
|
import {Plugin, Cordova} from './plugin';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The ActionSheet plugin shows a native list of options the user can choose from.
|
||||||
|
*/
|
||||||
@Plugin({
|
@Plugin({
|
||||||
name: 'ActionSheet',
|
name: 'ActionSheet',
|
||||||
plugin: 'cordova-plugin-actionsheet',
|
plugin: 'cordova-plugin-actionsheet',
|
||||||
@ -20,8 +23,8 @@ export class ActionSheet {
|
|||||||
* addCancelButtonWithLabel: string
|
* addCancelButtonWithLabel: string
|
||||||
* addDestructiveButtonWithLabel: string
|
* addDestructiveButtonWithLabel: string
|
||||||
* position: [x, y] (iPad pass in [x, y] coords of popover)
|
* position: [x, y] (iPad pass in [x, y] coords of popover)
|
||||||
* @returns {Promise} returns a promise that resolves with a number indicating
|
* @returns {Promise} returns a promise that resolves with the index of the
|
||||||
* which button was pressed (1 for first, 2 for second).
|
* button pressed (1 based, so 1, 2, 3, etc.)
|
||||||
*/
|
*/
|
||||||
@Cordova()
|
@Cordova()
|
||||||
static show(options?: {
|
static show(options?: {
|
||||||
@ -33,23 +36,26 @@ export class ActionSheet {
|
|||||||
addCancelButtonWithLabel?: string,
|
addCancelButtonWithLabel?: string,
|
||||||
addDestructiveButtonWithLabel?: string,
|
addDestructiveButtonWithLabel?: string,
|
||||||
position?: number[]
|
position?: number[]
|
||||||
}){
|
}) {
|
||||||
// This returned Promise is replaced by one from the @Cordova decorator,
|
// This Promise is replaced by one from the @Cordova decorator that wraps
|
||||||
// but since there's no way for TypeScript to know the return type from a
|
// the plugin's callbacks. We provide a dummy one here so TypeScript
|
||||||
// decorator we provide it. See https://github.com/Microsoft/TypeScript/issues/4881.
|
// knows that the correct return type is Promise, because there's no way
|
||||||
return new Promise<any>((s, e) => {});
|
// 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.
|
||||||
* @param {options}
|
|
||||||
*/
|
*/
|
||||||
@Cordova()
|
@Cordova()
|
||||||
static hide(options:any){
|
static hide() {
|
||||||
// This returned Promise is replaced by one from the @Cordova decorator,
|
// This Promise is replaced by one from the @Cordova decorator that wraps
|
||||||
// but since there's no way for TypeScript to know the return type from a
|
// the plugin's callbacks. We provide a dummy one here so TypeScript
|
||||||
// decorator we provide it. See https://github.com/Microsoft/TypeScript/issues/4881.
|
// knows that the correct return type is Promise, because there's no way
|
||||||
return new Promise<any>((s, e) => {});
|
// 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…
x
Reference in New Issue
Block a user