From 3b4ce7625b6fd3dbe6cb1fcecd68ccc145187f8b Mon Sep 17 00:00:00 2001 From: Jeff Wu Date: Mon, 18 Sep 2017 11:14:46 +0800 Subject: [PATCH] add props for BarcodeScanOptions --- .../phonegap-plugin-barcodescanner/index.d.ts | 11 +++++++++-- .../phonegap-plugin-barcodescanner-tests.ts | 18 ++++++++++++------ 2 files changed, 21 insertions(+), 8 deletions(-) diff --git a/types/phonegap-plugin-barcodescanner/index.d.ts b/types/phonegap-plugin-barcodescanner/index.d.ts index 85bde977b7..431cea4b94 100644 --- a/types/phonegap-plugin-barcodescanner/index.d.ts +++ b/types/phonegap-plugin-barcodescanner/index.d.ts @@ -1,6 +1,7 @@ // Type definitions for phonegap-plugin-barcodescanner // Project: https://github.com/phonegap/phonegap-plugin-barcodescanner // Definitions by: Nathan Ainslie +// Jeff Wu // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped interface CordovaPlugins { @@ -13,13 +14,19 @@ declare namespace phonegapBarcode { format: string; cancelled: boolean; } - + interface BarcodeScanOptions { preferFrontCamera?: boolean; showFlipCameraButton?: boolean; + showTorchButton?: boolean; + torchOn?: boolean; + saveHistory?: boolean; + resultDisplayDuration? :number; + disableAnimations: boolean; prompt?: string; formats?: string; orientation?: "landscape" | "portrait"; + disableSuccessBeep?: boolean; } interface EncodingType { @@ -34,4 +41,4 @@ declare namespace phonegapBarcode { encode: (encodingType: EncodingType, data: string, success: ((result: any) => any), failure?: ((err: any) => any)) => void; Encode: EncodingType; } -} \ No newline at end of file +} diff --git a/types/phonegap-plugin-barcodescanner/phonegap-plugin-barcodescanner-tests.ts b/types/phonegap-plugin-barcodescanner/phonegap-plugin-barcodescanner-tests.ts index 454a22fa85..39ac67fbb9 100644 --- a/types/phonegap-plugin-barcodescanner/phonegap-plugin-barcodescanner-tests.ts +++ b/types/phonegap-plugin-barcodescanner/phonegap-plugin-barcodescanner-tests.ts @@ -11,11 +11,17 @@ cordova.plugins.barcodeScanner.scan( alert("Scanning failed: " + error); }, { - "preferFrontCamera" : true, // iOS and Android - "showFlipCameraButton" : true, // iOS and Android - "prompt" : "Place a barcode inside the scan area", // supported on Android only - "formats" : "QR_CODE,PDF_417", // default: all but PDF_417 and RSS_EXPANDED - "orientation" : "landscape" // Android only (portrait|landscape), default unset so it rotates with the device + preferFrontCamera : true, // iOS and Android + showFlipCameraButton : true, // iOS and Android + showTorchButton : true, // iOS and Android + torchOn: true, // Android, launch with the torch switched on (if available) + saveHistory: true, // Android, save scan history (default false) + prompt : "Place a barcode inside the scan area", // Android + resultDisplayDuration: 500, // Android, display scanned text for X ms. 0 suppresses it entirely, default 1500 + formats : "QR_CODE,PDF_417", // default: all but PDF_417 and RSS_EXPANDED + orientation : "landscape", // Android only (portrait|landscape), default unset so it rotates with the device + disableAnimations : true, // iOS + disableSuccessBeep: false // iOS and Android } ); @@ -25,4 +31,4 @@ cordova.plugins.barcodeScanner.encode(cordova.plugins.barcodeScanner.Encode.TEXT }, function(fail) { alert("encoding failed: " + fail); } -); \ No newline at end of file +);