diff --git a/dist/plugins/actionsheet.d.ts b/dist/plugins/actionsheet.d.ts index 7faea1795..e0d46593a 100644 --- a/dist/plugins/actionsheet.d.ts +++ b/dist/plugins/actionsheet.d.ts @@ -1,4 +1,32 @@ export declare class ActionSheet { - static show(options: any): void; - static hide(options: any): void; + /** + * 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). + */ + static show(options?: { + buttonLabels: string[]; + title?: string; + androidTheme?: number; + androidEnableCancelButton?: boolean; + winphoneEnableCancelButton?: boolean; + addCancelButtonWithLabel?: string; + addDestructiveButtonWithLabel?: string; + position?: number[]; + }): Promise; + /** + * Hide the ActionSheet. + * @param {options} + */ + static hide(options: any): Promise; } diff --git a/dist/plugins/actionsheet.js b/dist/plugins/actionsheet.js index d638c1299..f0c31290d 100644 --- a/dist/plugins/actionsheet.js +++ b/dist/plugins/actionsheet.js @@ -8,9 +8,38 @@ var plugin_1 = require('./plugin'); var ActionSheet = (function () { function ActionSheet() { } - ActionSheet.show = function (options) { }; + /** + * 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). + */ + ActionSheet.show = function (options) { + // 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(function (s, e) { }); + }; ; - ActionSheet.hide = function (options) { }; + /** + * Hide the ActionSheet. + * @param {options} + */ + ActionSheet.hide = function (options) { + // 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(function (s, e) { }); + }; ; __decorate([ plugin_1.Cordova() diff --git a/dist/plugins/actionsheet.js.map b/dist/plugins/actionsheet.js.map index 977554008..1412dfa7b 100644 --- a/dist/plugins/actionsheet.js.map +++ b/dist/plugins/actionsheet.js.map @@ -1 +1 @@ -{"version":3,"file":"actionsheet.js","sourceRoot":"","sources":["../../src/plugins/actionsheet.ts"],"names":["ActionSheet","ActionSheet.constructor","ActionSheet.show","ActionSheet.hide"],"mappings":";;;;;;AAAA,uBAA8B,UAAU,CAAC,CAAA;AAEzC;IAAAA;IAYAC,CAACA;IAJQD,gBAAIA,GADXA,UACYA,OAAWA,IAAEE,CAACA;;IAGnBF,gBAAIA,GADXA,UACYA,OAAWA,IAAEG,CAACA;;IAJ1BH;QAACA,gBAAOA,EAAEA;OACHA,mBAAIA,QAAeA;IAE1BA;QAACA,gBAAOA,EAAEA;OACHA,mBAAIA,QAAeA;IAX5BA;QAACA,eAAMA,CAACA;YACNA,IAAIA,EAAEA,aAAaA;YACnBA,MAAMA,EAAEA,4BAA4BA;YACpCA,SAASA,EAAEA,qBAAqBA;YAChCA,IAAIA,EAAEA,8DAA8DA;SACrEA,CAACA;oBAODA;IAADA,kBAACA;AAADA,CAACA,AAZD,IAYC;AANY,mBAAW,cAMvB,CAAA"} \ No newline at end of file +{"version":3,"file":"actionsheet.js","sourceRoot":"","sources":["../../src/plugins/actionsheet.ts"],"names":["ActionSheet","ActionSheet.constructor","ActionSheet.show","ActionSheet.hide"],"mappings":";;;;;;AAAA,uBAA8B,UAAU,CAAC,CAAA;AAEzC;IAAAA;IAoDAC,CAACA;IA5CCD;;;;;;;;;;;;;;OAcGA;IAEIA,gBAAIA,GADXA,UACYA,OASXA;QACCE,wEAAwEA;QACxEA,yEAAyEA;QACzEA,oFAAoFA;QACpFA,MAAMA,CAACA,IAAIA,OAAOA,CAAMA,UAACA,CAACA,EAAEA,CAACA,IAAMA,CAACA,CAACA,CAACA;IACxCA,CAACA;;IAGDF;;;OAGGA;IAEIA,gBAAIA,GADXA,UACYA,OAAWA;QACrBG,wEAAwEA;QACxEA,yEAAyEA;QACzEA,oFAAoFA;QACpFA,MAAMA,CAACA,IAAIA,OAAOA,CAAMA,UAACA,CAACA,EAAEA,CAACA,IAAMA,CAACA,CAACA,CAACA;IACxCA,CAACA;;IA5BDH;QAACA,gBAAOA,EAAEA;OACHA,mBAAIA,QAcVA;IAODA;QAACA,gBAAOA,EAAEA;OACHA,mBAAIA,QAKVA;IAnDHA;QAACA,eAAMA,CAACA;YACNA,IAAIA,EAAEA,aAAaA;YACnBA,MAAMA,EAAEA,4BAA4BA;YACpCA,SAASA,EAAEA,qBAAqBA;YAChCA,IAAIA,EAAEA,8DAA8DA;SACrEA,CAACA;oBA+CDA;IAADA,kBAACA;AAADA,CAACA,AApDD,IAoDC;AA9CY,mBAAW,cA8CvB,CAAA"} \ No newline at end of file diff --git a/src/plugins/actionsheet.ts b/src/plugins/actionsheet.ts index a3555cae2..9d0c1d4ae 100644 --- a/src/plugins/actionsheet.ts +++ b/src/plugins/actionsheet.ts @@ -7,9 +7,49 @@ import {Plugin, Cordova} from './plugin'; repo: 'https://github.com/EddyVerbruggen/cordova-plugin-actionsheet' }) export class ActionSheet { - @Cordova() - static show(options:any){}; + /** + * 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). + */ @Cordova() - static hide(options:any){}; + 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((s, e) => {}); + }; + + + /** + * 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((s, e) => {}); + }; }