Scanner module responsible for scanning QR/ EAN/ DataMatrix codes
Note: Following code formats are supported.
EAN-8, EAN-13, Code 39, Code 128, ITF, RSS-14, QR Code, Data Matrix
Classes
Methods
(static) create(options) → {App.Scanner.Scanner}
Creates new scanner instance
Example
// 1. Auto Scan
// .. default scan action, open object or search for scanned text
App.scanner.create();
// .. get control when item is scanned
App.scanner.create({options: {
'onScanComplete': scannedText => {console.log(scannedText)},
}});
// 2. Manual Scan
const scanner = App.scanner.create({options: {
'onScanComplete': scannedText => {console.log(scannedText)},
'autoScan': false
}});
// .. using default camera
scanner.startScanning();
...
scanner.stopScanning();
// .. using preferred camera
scanner.initScanners()
.then(scanner.renderUi)
.then(() => {
const scanners = scanner.getScanners();
const deviceId = '<logic to get preferred camera from scanners>';
return deviceId;
})
.then(scanner.scan)
.catch(scanner.handleError);
Parameters:
Name | Type | Description | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
object | options passed to the scanner instance Properties
|
Returns:
- Type
- App.Scanner.Scanner