Introducing Socket Firewall: Free, Proactive Protection for Your Software Supply Chain.Learn More
Socket
Book a DemoInstallSign in
Socket

@itexperts/barcode-scanner

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@itexperts/barcode-scanner

A simple JS to listen for barcode scans

latest
Source
npmnpm
Version
1.0.1
Version published
Maintainers
1
Created
Source

Barcode scanner

A simple EventTarget for JavaScript to listen to barcode scans done with a keyboard barcode scanner.

When working with plug-and-play USB barcode scanners, it can be a pain to know when a barcode has been scanned. Usually these scanners will be set up as keyboard and "very quickly type" the barcode. We leverage this to detect whether a barcode was scanned. Normally a barcode scanner will type a character within 10ms. Therefore an EAN-13 barcode will need at most 130ms to complete. As a human you'd be fast if you typed a single character every 130ms (unless you are the flash).

Installation

Using Yarn

yarn add @itexperts/barcode-scanner

Using NPM

npm i @itexperts/barcode-scanner

Usage

import {BarcodeScanner} from "@itexperts/barcode-scanner";

let options = {
  timeOut: 130,
  characterCount: 13
}

let barcodeScanner = new BarcodeScanner(options);
barcodeScanner.addEventListener('scan', function(e){
    let barcode = e.detail;
    console.log(barcode);
});

Options

namedefault valuedescription
timeOut130ms within which the characters must be typed
characterCount13Amount of characters (13 for EAN-13

Keywords

barcode

FAQs

Package last updated on 07 Oct 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts