js-scanner-handler
v0.1.2
Published
Simple wrapper for barcode and qr code readers HID that will fire custom event if input from scanner is detected. Detection at this point is based on time between next input characters.
Downloads
4
Readme
jsScannerHandler
Small js script adding barcode/qrcode scanner custom event emulation for websites;
How does it works
Register DOM element which will react to keydown event. Best option is to use document.
new ScannerHandler.register(document);
After that add event listener to document element on scanEnd event.
document.addEventListener('scanEnd', function(e) {
document.querySelector("#sth").innerHTML = e.detail.value;
});
Value readed by scanner will be in event.detail.value.