@scr2em/capacitor-scanner
v6.0.5
Published
scan codes
Downloads
42
Readme
Capacitor Scanner
scan codes
Install
npm install capacitor-scanner
npx cap sync
API
startScanning(...)
stopScanning()
openSettings()
capturePhoto()
checkPermissions()
requestPermissions()
addListener('barcodeScanned', ...)
removeAllListeners()
- Type Aliases
- Enums
startScanning(...)
startScanning(options?: ScannerOptions | undefined) => Promise<void>
| Param | Type |
| ------------- | --------------------------------------------------------- |
| options
| ScannerOptions |
stopScanning()
stopScanning() => Promise<void>
openSettings()
openSettings() => Promise<void>
capturePhoto()
capturePhoto() => Promise<CapturePhotoResult>
Returns: Promise<CapturePhotoResult>
checkPermissions()
checkPermissions() => Promise<PermissionsResult>
Returns: Promise<PermissionsResult>
requestPermissions()
requestPermissions() => Promise<PermissionsResult>
Returns: Promise<PermissionsResult>
addListener('barcodeScanned', ...)
addListener(event: 'barcodeScanned', listenerFunc: (result: BarcodeScannedEvent) => void) => Promise<void>
| Param | Type |
| ------------------ | ---------------------------------------------------------------------------------------- |
| event
| 'barcodeScanned' |
| listenerFunc
| (result: BarcodeScannedEvent) => void |
removeAllListeners()
removeAllListeners() => Promise<void>
Type Aliases
ScannerOptions
{ formats?: BarcodeFormat[]; cameraDirection?: 'BACK' | 'FRONT'; debounceTimeInMilli?: number }
CapturePhotoResult
{ imageBase64: string }
PermissionsResult
{ camera: 'prompt' | 'denied' | 'granted' }
BarcodeScannedEvent
{ scannedCode: string; format: string }
Enums
BarcodeFormat
| Members | Value |
| ---------------- | -------------------------- |
| Aztec
| 'AZTEC' |
| Code39
| 'CODE_39' |
| Code93
| 'CODE_93' |
| Code128
| 'CODE_128' |
| DataMatrix
| 'DATA_MATRIX' |
| Ean8
| 'EAN_8' |
| Ean13
| 'EAN_13' |
| Itf14
| 'ITF14' |
| Pdf417
| 'PDF_417' |
| QrCode
| 'QR_CODE' |
| UpcE
| 'UPC_E' |