1.1.0 • Published 11 months ago

js-scanner-detection v1.1.0

Weekly downloads
241
License
MIT
Repository
github
Last release
11 months ago

📦 Getting Started

npm i js-scanner-detection

💎 Example Usage

import ScannerDetector from 'js-scanner-detection'
let onComplete = (barcode)=>{
  // Do stuff with the barcode
  console.log(barcode)
}
let options = {
  onComplete:onComplete
}
let scannerDetector = new ScannerDetector(options)

// To remove the event listener and stop the scanner
scannerDetector.stopScanning()

✅ Options

{
      onComplete: false, // Callback after detection of a successful scanning
      onError: false, // Callback after detection of a unsuccessful scanning
      onReceive: false, // Callback after receive a char
      timeBeforeScanTest: 100, // Wait duration (ms) after keypress event to check if scanning is finished
      avgTimeByChar: 30, // Average time (ms) between 2 chars. Used to do difference between keyboard typing and scanning
      minLength: 6, // Minimum length for a scanning
      endChar: [9, 13], // Chars to remove and means end of scanning
      stopPropagation: false, // Stop immediate propagation on keypress event
      preventDefault: false // Prevent default action on keypress event
    }
1.1.0

11 months ago

1.0.5

12 months ago

1.0.4

12 months ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago