1.0.1 • Published 4 years ago

barcode-hid-reader v1.0.1

Weekly downloads
10
License
Apache-2.0
Repository
github
Last release
4 years ago

barcode_hid_reader

simple js lib for capturing events from HID barcode scanners

installing via npm:

npm i barcode-hid-reader

import

if using bundler:

import barcode from "barcode-hid-reader";

start capturing:

function onBarcode(barcode) {
  console.log(barcode);
},

// all options are optional, below is default values:
let options = {
    timeout: 30, // timeout between symbols in ms, increase if scanning is unstable
    prefix: "", // barcode prefix
    suffix: "Enter", // barcode suffix
    callback: dispatchEvent, // callback. default is dispatchig custom "barcode" event
    log: false // boolean or callback. if true log into console, if funcion call function with arguments: state, event, event.custom
};

barcode.startCapturing(document, {
  callback: onBarcode,
  ...options
});

stop capturing

barcode.stopCapturing();

Copyright 2019 Anton Grachev

1.0.1

4 years ago

1.0.0

4 years ago