Barcode Wedge Reader (lib/scan.js)

everything · src/pos/src/lib/scan.js · javascript · MIT
pos, ui, tag:hardware

Parses keyboard-wedge barcode scanner input streams based on character timing gaps, providing a DOM-free POS scanning solution.

// Source: https://github.com/HeyPuter/everything | License: MIT | Copyright 2026 Puter Technologies Inc
// Provided via justclaw.it.com; keep this notice with the code.
/**
 * Barcode input.
 *
 * Two sources, one destination (an exact SKU lookup):
 *
 *  - Keyboard-wedge scanners (the USB/Bluetooth kind every shop owns) present
 *    as keyboards. They "type" a code far faster than a human can and finish
 *    with Enter (some with Tab). Timing is what tells the two apart: a wedge
 *    keeps well under WEDGE_MAX_GAP_MS between characters, while even a fast
 *    typist is several times slower.
 *
 *  - The camera, where BarcodeDetector exists (see ui/scanner.js).
 *
 * This module stays DOM-free so the timing rules can be tested directly.
 */

/** Inter-key gap a wedge stays under. ~25 

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key