diff --git a/src/plugins/barcodescanner.ts b/src/plugins/barcodescanner.ts index 5a798fb7..af769e31 100644 --- a/src/plugins/barcodescanner.ts +++ b/src/plugins/barcodescanner.ts @@ -1,5 +1,44 @@ import { Cordova, Plugin } from './plugin'; +export interface BarcodeScannerOptions { + + /** + * Prefer front camera. Supported on iOS and Android. + */ + preferFrontCamera?: boolean; + + /** + * Show flip camera button. Supported on iOS and Android. + */ + showFlipCameraButton?: boolean; + + /** + * Show torch button. Supported on iOS and Android. + */ + showTorchButton?: boolean; + + /** + * Disable animations. Supported on iOS only. + */ + disableAnimations?: boolean; + + /** + * Prompt text. Supported on Android only. + */ + prompt?: string; + + /** + * Formats separated by commas. Defaults to all formats except `PDF_417` and `RSS_EXPANDED`. + */ + formats?: string; + + /** + * Orientation. Supported on Android only. Can be set to `portrait` or `landscape`. Defaults to none so the user can rotate the phone and pick an orientation. + */ + orientation?: string; + +} + /** * @name Barcode Scanner * @description @@ -18,6 +57,8 @@ import { Cordova, Plugin } from './plugin'; * // An error occurred * }); * ``` + * @interfaces + * BarcodeScannerOptions */ @Plugin({ pluginName: 'BarcodeScanner', @@ -40,13 +81,13 @@ export class BarcodeScanner { /** * Open the barcode scanner. - * @param options {Object} Optional options to pass to the scanner + * @param options {BarcodeScannerOptions} Optional options to pass to the scanner * @returns {Promise} Returns a Promise that resolves with scanner data, or rejects with an error. */ @Cordova({ callbackOrder: 'reverse' }) - static scan(options?: any): Promise { return; } + static scan(options?: BarcodeScannerOptions): Promise { return; } /** * Encodes data into a barcode.