A Web Component that works with most barcode scanners.
Click the icon in the bottom right corner to start scanning, or add the auto
attribute to start automatically.
<barcode-scanner></barcode-scanner>
import { BarcodeScanner } from './index.js';
BarcodeScanner.mount();
element.addEventListener('bs:entry', event => ...)
auto
clear
clear="5000"
(default: 2 seconds)debug
input
maxlength
maxlength="12"
(default: 14, minimum: 8)minlength
minlength="10"
(default: 8, cannot exceed maxlength)terminate-char
terminate-char="\n"
(default: Enter key)bs:entry
event.detail.value
bs:clear
<barcode-scanner auto debug input>
</barcode-scanner>
If you don't have a barcode-scanner, you can manually type a barcode and press Enter.
See the console for debug information.