![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
simple-barcode-scanner
Advanced tools
Utility to read barcode from devices emulating a fast keyboard
A simple JavaScript utility to read barcode from devices emulating a fast keyboard.
# Yarn
yarn add simple-barcode-scanner
# NPM
npm install --save simple-barcode-scanner
Then with a module bundler like rollup or webpack, use as you would anything else:
// using ES6 modules
import BarcodeScanner from "simple-barcode-scanner";
// using CommonJS modules
const BarcodeScanner = require("simple-barcode-scanner");
The UMD build is also available on unpkg:
<script src="https://unpkg.com/simple-barcode-scanner"></script>
You can find the library on window.BarcodeScanner
.
import BarcodeScanner from "simple-barcode-scanner";
const scanner = BarcodeScanner();
// Add a listener
scanner.on((code, event) => {
event.preventDefault();
console.log(code);
});
// Remove the listener
scanner.off();
Creates a simple function to listen to barcode scanners
Parameters
Options
Object
latency
Number Max time duration (in ms) between consecutive inputs
default: 50
minLength
Number Min length of a valid barcode
default: 3
element
HTMLElement The HTML element to attach the event listener to
default: document
endKeys
Array<string> Array of keys indicating end of barcode
Refer Key Values | MDN
default: ["Enter"]
validKey
RegExp Regular expression to check for a valid key in barcode
Refer Key Values | MDN
default: /^\w$/
Returns Scanner
Starts listening for barcode scans and add/replace the listener
Parameters
handler Function Function to call on completion of barcode scan
Recieves the scanned code and the keyboard event of the last input as the parameters
Stop listening for barcode scans and remove the listener
First off, thanks for taking the time to contribute! Now, take a moment to be sure your contributions make sense to everyone else.
Development Start:
This project uses Typescript for development and yarn for dependency management.
Found a problem? Want a new feature? First of all see if your issue or idea has already been reported. If not, just open a new clear and descriptive issue.
Pull requests are the greatest contributions, so be sure they are focused in scope, and do avoid unrelated commits.
git clone https://github.com/<your-username>/simple-barcode-scanner
cd simple-barcode-scanner
git checkout -b my-new-feature
yarn
git commit -am 'Add some feature'
git push origin my-new-feature
FAQs
Utility to read barcode from devices emulating a fast keyboard
The npm package simple-barcode-scanner receives a total of 385 weekly downloads. As such, simple-barcode-scanner popularity was classified as not popular.
We found that simple-barcode-scanner demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.