From 6688c4d91d38bd0407a570ac34882729f844554a Mon Sep 17 00:00:00 2001 From: Tim Lancina Date: Sun, 7 Feb 2016 16:12:13 -0600 Subject: [PATCH] chore(): update barcodescanner --- dist/plugins/actionsheet.d.ts | 10 ++++++---- dist/plugins/actionsheet.js | 30 ++++++++++++++++++------------ dist/plugins/actionsheet.js.map | 2 +- dist/plugins/barcodescanner.d.ts | 9 ++++++--- dist/plugins/barcodescanner.js | 16 +++++++++++++--- dist/plugins/barcodescanner.js.map | 2 +- dist/plugins/plugin.js | 2 +- src/plugins/barcodescanner.ts | 21 ++++++++++++++++++--- 8 files changed, 64 insertions(+), 28 deletions(-) diff --git a/dist/plugins/actionsheet.d.ts b/dist/plugins/actionsheet.d.ts index e0d46593a..fbef2aa8f 100644 --- a/dist/plugins/actionsheet.d.ts +++ b/dist/plugins/actionsheet.d.ts @@ -1,3 +1,6 @@ +/** + * The ActionSheet plugin shows a native list of options the user can choose from. + */ export declare class ActionSheet { /** * Show the ActionSheet. @@ -11,8 +14,8 @@ export declare 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.) */ static show(options?: { buttonLabels: string[]; @@ -26,7 +29,6 @@ export declare class ActionSheet { }): Promise; /** * Hide the ActionSheet. - * @param {options} */ - static hide(options: any): Promise; + static hide(): Promise; } diff --git a/dist/plugins/actionsheet.js b/dist/plugins/actionsheet.js index f0c31290d..efc1c627b 100644 --- a/dist/plugins/actionsheet.js +++ b/dist/plugins/actionsheet.js @@ -5,6 +5,9 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key, return c > 3 && r && Object.defineProperty(target, key, r), r; }; var plugin_1 = require('./plugin'); +/** + * The ActionSheet plugin shows a native list of options the user can choose from. + */ var ActionSheet = (function () { function ActionSheet() { } @@ -20,25 +23,28 @@ var ActionSheet = (function () { * 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.) */ 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) { }); + // 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(function (res, rej) { }); }; ; /** * 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) { }); + ActionSheet.hide = function () { + // 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(function (res, rej) { }); }; ; __decorate([ diff --git a/dist/plugins/actionsheet.js.map b/dist/plugins/actionsheet.js.map index 1412dfa7b..4374bf18a 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;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 +{"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;;GAEG;AACH;IAAAA;IAuDAC,CAACA;IA/CCD;;;;;;;;;;;;;;OAcGA;IAEIA,gBAAIA,GADXA,UACYA,OASXA;QACCE,yEAAyEA;QACzEA,oEAAoEA;QACpEA,wEAAwEA;QACxEA,mDAAmDA;QACnDA,0DAA0DA;QAC1DA,MAAMA,CAACA,IAAIA,OAAOA,CAAMA,UAACA,GAAGA,EAAEA,GAAGA,IAAMA,CAACA,CAACA,CAACA;IAC5CA,CAACA;;IAGDF;;OAEGA;IAEIA,gBAAIA,GADXA;QAEEG,yEAAyEA;QACzEA,oEAAoEA;QACpEA,wEAAwEA;QACxEA,mDAAmDA;QACnDA,0DAA0DA;QAC1DA,MAAMA,CAACA,IAAIA,OAAOA,CAAMA,UAACA,GAAGA,EAAEA,GAAGA,IAAMA,CAACA,CAACA,CAACA;IAC5CA,CAACA;;IA/BDH;QAACA,gBAAOA,EAAEA;OACHA,mBAAIA,QAgBVA;IAMDA;QAACA,gBAAOA,EAAEA;OACHA,mBAAIA,QAOVA;IAtDHA;QAACA,eAAMA,CAACA;YACNA,IAAIA,EAAEA,aAAaA;YACnBA,MAAMA,EAAEA,4BAA4BA;YACpCA,SAASA,EAAEA,qBAAqBA;YAChCA,IAAIA,EAAEA,8DAA8DA;SACrEA,CAACA;oBAkDDA;IAADA,kBAACA;AAADA,CAACA,AAvDD,IAuDC;AAjDY,mBAAW,cAiDvB,CAAA"} \ No newline at end of file diff --git a/dist/plugins/barcodescanner.d.ts b/dist/plugins/barcodescanner.d.ts index db0e9bd91..28a6ad432 100644 --- a/dist/plugins/barcodescanner.d.ts +++ b/dist/plugins/barcodescanner.d.ts @@ -1,11 +1,11 @@ /** * The Barcode Scanner Plugin opens a camera view and automatically scans a barcode, returning the data back to you. * - * Requires Cordova plugin: `phonegap-plugin-barcodescanner`. For more info, please see the [BardcodeScanner plugin docs](https://github.com/phonegap/phonegap-plugin-barcodescanner). + * Requires Cordova plugin: `phonegap-plugin-barcodescanner`. For more info, please see the [BarcodeScanner plugin docs](https://github.com/phonegap/phonegap-plugin-barcodescanner). * * @usage * ```js - * BarcodeScanner.scan(options).then((barcodeData) => { + * BarcodeScanner.scan().then((barcodeData) => { * // Success! Barcode data is here * }, (err) => { * // An error occurred @@ -13,5 +13,8 @@ * ``` */ export declare class BarcodeScanner { - static scan(options: any): void; + /** + * Open the barcode scanner. + */ + static scan(): Promise; } diff --git a/dist/plugins/barcodescanner.js b/dist/plugins/barcodescanner.js index 9a8aefcf5..051669a74 100644 --- a/dist/plugins/barcodescanner.js +++ b/dist/plugins/barcodescanner.js @@ -8,11 +8,11 @@ var plugin_1 = require('./plugin'); /** * The Barcode Scanner Plugin opens a camera view and automatically scans a barcode, returning the data back to you. * - * Requires Cordova plugin: `phonegap-plugin-barcodescanner`. For more info, please see the [BardcodeScanner plugin docs](https://github.com/phonegap/phonegap-plugin-barcodescanner). + * Requires Cordova plugin: `phonegap-plugin-barcodescanner`. For more info, please see the [BarcodeScanner plugin docs](https://github.com/phonegap/phonegap-plugin-barcodescanner). * * @usage * ```js - * BarcodeScanner.scan(options).then((barcodeData) => { + * BarcodeScanner.scan().then((barcodeData) => { * // Success! Barcode data is here * }, (err) => { * // An error occurred @@ -22,7 +22,17 @@ var plugin_1 = require('./plugin'); var BarcodeScanner = (function () { function BarcodeScanner() { } - BarcodeScanner.scan = function (options) { }; + /** + * Open the barcode scanner. + */ + BarcodeScanner.scan = function () { + // 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(function (res, rej) { }); + }; ; __decorate([ plugin_1.Cordova() diff --git a/dist/plugins/barcodescanner.js.map b/dist/plugins/barcodescanner.js.map index a0c201145..4bbb668a2 100644 --- a/dist/plugins/barcodescanner.js.map +++ b/dist/plugins/barcodescanner.js.map @@ -1 +1 @@ -{"version":3,"file":"barcodescanner.js","sourceRoot":"","sources":["../../src/plugins/barcodescanner.ts"],"names":["BarcodeScanner","BarcodeScanner.constructor","BarcodeScanner.scan"],"mappings":";;;;;;AAAA,uBAA8B,UAAU,CAAC,CAAA;AAEzC;;;;;;;;;;;;;GAaG;AACH;IAAAA;IAQAC,CAACA;IADQD,mBAAIA,GADXA,UACYA,OAAWA,IAAEE,CAACA;;IAD1BF;QAACA,gBAAOA,EAAEA;OACHA,sBAAIA,QAAeA;IAP5BA;QAACA,eAAMA,CAACA;YACNA,IAAIA,EAAEA,gBAAgBA;YACtBA,MAAMA,EAAEA,gCAAgCA;YACxCA,SAASA,EAAEA,gCAAgCA;SAC5CA,CAACA;uBAIDA;IAADA,qBAACA;AAADA,CAACA,AARD,IAQC;AAHY,sBAAc,iBAG1B,CAAA"} \ No newline at end of file +{"version":3,"file":"barcodescanner.js","sourceRoot":"","sources":["../../src/plugins/barcodescanner.ts"],"names":["BarcodeScanner","BarcodeScanner.constructor","BarcodeScanner.scan"],"mappings":";;;;;;AAAA,uBAA8B,UAAU,CAAC,CAAA;AAEzC;;;;;;;;;;;;;GAaG;AACH;IAAAA;IAuBAC,CAACA;IAhBCD;;OAEGA;IAEIA,mBAAIA,GADXA;QAEEE,yEAAyEA;QACzEA,oEAAoEA;QACpEA,wEAAwEA;QACxEA,mDAAmDA;QACnDA,0DAA0DA;QAC1DA,MAAMA,CAACA,IAAIA,OAAOA,CAAMA,UAACA,GAAGA,EAAEA,GAAGA,IAAMA,CAACA,CAACA,CAACA;IAC5CA,CAACA;;IARDF;QAACA,gBAAOA,EAAEA;OACHA,sBAAIA,QAOVA;IAlBHA;QAACA,eAAMA,CAACA;YACNA,IAAIA,EAAEA,gBAAgBA;YACtBA,MAAMA,EAAEA,gCAAgCA;YACxCA,SAASA,EAAEA,gCAAgCA;SAC5CA,CAACA;uBAmBDA;IAADA,qBAACA;AAADA,CAACA,AAvBD,IAuBC;AAlBY,sBAAc,iBAkB1B,CAAA"} \ No newline at end of file diff --git a/dist/plugins/plugin.js b/dist/plugins/plugin.js index 4bf6471e5..788c6d014 100644 --- a/dist/plugins/plugin.js +++ b/dist/plugins/plugin.js @@ -30,7 +30,7 @@ function callCordovaPlugin(pluginObj, methodName, args, opts, resolve, reject) { if (opts === void 0) { opts = {}; } // If the plugin method expects myMethod(success, err, options) if (opts.callbackOrder == 'reverse') { - // Get those arguments in the order [reject, resolve, ...restOfArgs] + // Get those arguments in the order [resolve, reject, ...restOfArgs] args.unshift(reject); args.unshift(resolve); } diff --git a/src/plugins/barcodescanner.ts b/src/plugins/barcodescanner.ts index 0a9172cb7..d44d8f403 100644 --- a/src/plugins/barcodescanner.ts +++ b/src/plugins/barcodescanner.ts @@ -3,11 +3,11 @@ import {Plugin, Cordova} from './plugin'; /** * The Barcode Scanner Plugin opens a camera view and automatically scans a barcode, returning the data back to you. * - * Requires Cordova plugin: `phonegap-plugin-barcodescanner`. For more info, please see the [BardcodeScanner plugin docs](https://github.com/phonegap/phonegap-plugin-barcodescanner). + * Requires Cordova plugin: `phonegap-plugin-barcodescanner`. For more info, please see the [BarcodeScanner plugin docs](https://github.com/phonegap/phonegap-plugin-barcodescanner). * * @usage * ```js - * BarcodeScanner.scan(options).then((barcodeData) => { + * BarcodeScanner.scan().then((barcodeData) => { * // Success! Barcode data is here * }, (err) => { * // An error occurred @@ -20,6 +20,21 @@ import {Plugin, Cordova} from './plugin'; pluginRef: 'cordova.plugins.barcodeScanner' }) export class BarcodeScanner { + + /** + * Open the barcode scanner. + */ @Cordova() - static scan(options:any){}; + 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((res, rej) => {}); + }; + + // Not well supported + // @Cordova() + // static encode(type, data){}; }