mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-13 22:40:50 +08:00
add props for BarcodeScanOptions
This commit is contained in:
11
types/phonegap-plugin-barcodescanner/index.d.ts
vendored
11
types/phonegap-plugin-barcodescanner/index.d.ts
vendored
@@ -1,6 +1,7 @@
|
||||
// Type definitions for phonegap-plugin-barcodescanner
|
||||
// Project: https://github.com/phonegap/phonegap-plugin-barcodescanner
|
||||
// Definitions by: Nathan Ainslie <https://www.github.com/nainslie>
|
||||
// Jeff Wu <https://www.github.com/jeffwu85182>
|
||||
// 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
);
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user