Skip to content
This repository has been archived by the owner on Apr 9, 2020. It is now read-only.

goodeggs/barcode-scan-listener

Repository files navigation

Barcode Scan Listener

Listen for barcode scan events in the browser.

Usage

npm i barcode-scan-listener --save
import barcodeScanListener from 'barcode-scan-listener';

const removeScanListener = barcodeScanListener.onScan({
  barcodePrefix: 'L%',
  barcodeValueTest: /^123$/,
  finishScanOnMatch: true,
  scanDuration: 500
}, function (barcode) {
  console.log(barcode);
});

// Now, scanning a barcode 'L%123abc' will log '123'

removeScanListener()

Contributing

This module is written in ES2015 and converted to node-friendly CommonJS via Babel.

To compile the src directory to build:

npm run build

Deploying a new version

npm version [major|minor|patch]
npm run build
npm publish build # publish the build directory instead of the main directory
git push --follow-tags # update github

About

Listen for barcode scan events in the browser.

Resources

Stars

Watchers

Forks

Packages

No packages published