@ionic-native/barcode-scanner
- Version 5.36.0
- Published
- 25.2 kB
- 1 dependency
- MIT license
Install
npm i @ionic-native/barcode-scanner
yarn add @ionic-native/barcode-scanner
pnpm add @ionic-native/barcode-scanner
Overview
Ionic Native - Native plugins for ionic apps
Index
Variables
variable BarcodeScanner
const BarcodeScanner: BarcodeScannerOriginal;
Classes
class BarcodeScannerOriginal
class BarcodeScannerOriginal extends IonicNativePlugin {}
Barcode Scanner 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 [BarcodeScanner plugin docs](https://github.com/phonegap/phonegap-plugin-barcodescanner).import { BarcodeScanner } from '@ionic-native/barcode-scanner/ngx';constructor(private barcodeScanner: BarcodeScanner) { }...this.barcodeScanner.scan().then(barcodeData => {console.log('Barcode data', barcodeData);}).catch(err => {console.log('Error', err);});BarcodeScannerOptions BarcodeScanResult
property Encode
Encode: { TEXT_TYPE: string; EMAIL_TYPE: string; PHONE_TYPE: string; SMS_TYPE: string;};
method encode
encode: (type: string, data: any) => Promise<any>;
Encodes data into a barcode. NOTE: not well supported on Android
Parameter type
Type of encoding
Parameter data
Data to encode
Returns
{Promise}
method scan
scan: (options?: BarcodeScannerOptions) => Promise<BarcodeScanResult>;
Open the barcode scanner.
Parameter options
Optional options to pass to the scanner
Returns
{Promise} Returns a Promise that resolves with scanner data, or rejects with an error.
Interfaces
interface BarcodeScannerOptions
interface BarcodeScannerOptions {}
property disableAnimations
disableAnimations?: boolean;
Disable animations. Supported on iOS only.
property disableSuccessBeep
disableSuccessBeep?: boolean;
Disable success beep. Supported on iOS only.
property formats
formats?: string;
Formats separated by commas. Defaults to all formats except
PDF_417
andRSS_EXPANDED
.
property orientation
orientation?: string;
Orientation. Supported on Android only. Can be set to
portrait
orlandscape
. Defaults to none so the user can rotate the phone and pick an orientation.
property preferFrontCamera
preferFrontCamera?: boolean;
Prefer front camera. Supported on iOS and Android.
property prompt
prompt?: string;
Prompt text. Supported on Android only.
property resultDisplayDuration
resultDisplayDuration?: number;
Display scanned text for X ms. 0 suppresses it entirely, default 1500. Supported on Android only.
property saveHistory
saveHistory?: boolean;
Save scan history. Defaults to
false
. Supported on Android only.
property showFlipCameraButton
showFlipCameraButton?: boolean;
Show flip camera button. Supported on iOS and Android.
property showTorchButton
showTorchButton?: boolean;
Show torch button. Supported on iOS and Android.
property torchOn
torchOn?: boolean;
Launch with the torch switched on (if available). Supported on Android only.
interface BarcodeScanResult
interface BarcodeScanResult {}
Package Files (1)
Dependencies (1)
Dev Dependencies (0)
No dev dependencies.
Peer Dependencies (2)
Badge
To add a badge like this oneto your package's README, use the codes available below.
You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/@ionic-native/barcode-scanner
.
- Markdown[![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/@ionic-native/barcode-scanner)
- HTML<a href="https://www.jsdocs.io/package/@ionic-native/barcode-scanner"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>
- Updated .
Package analyzed in 2069 ms. - Missing or incorrect documentation? Open an issue for this package.