chore(): update barcodescanner

This commit is contained in:
Tim Lancina 2016-02-07 16:12:13 -06:00
parent 6fcba5cc3f
commit 6688c4d91d
8 changed files with 64 additions and 28 deletions

View File

@ -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<any>;
/**
* Hide the ActionSheet.
* @param {options}
*/
static hide(options: any): Promise<any>;
static hide(): Promise<any>;
}

View File

@ -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([

View File

@ -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"}
{"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"}

View File

@ -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<any>;
}

View File

@ -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()

View File

@ -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"}
{"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"}

View File

@ -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);
}

View File

@ -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<any>((res, rej) => {});
};
// Not well supported
// @Cordova()
// static encode(type, data){};
}