mirror of
https://github.com/danielsogl/awesome-cordova-plugins.git
synced 2025-02-01 02:53:03 +08:00
refractor(barcode-scanner): add BarcodeScannerOptions interface
This commit is contained in:
parent
4abb6ec78e
commit
95ca373e10
@ -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<any>} Returns a Promise that resolves with scanner data, or rejects with an error.
|
||||
*/
|
||||
@Cordova({
|
||||
callbackOrder: 'reverse'
|
||||
})
|
||||
static scan(options?: any): Promise<any> { return; }
|
||||
static scan(options?: BarcodeScannerOptions): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Encodes data into a barcode.
|
||||
|
Loading…
Reference in New Issue
Block a user