Refactor input handlings slightly
This commit is contained in:
parent
f9435c3a21
commit
26fac96b14
1 changed files with 5 additions and 9 deletions
14
src/App.tsx
14
src/App.tsx
|
|
@ -99,16 +99,12 @@ function App() {
|
|||
// Handle keyboard/scanner input
|
||||
useEffect(() => {
|
||||
const handleKeyDown = (ev: KeyboardEvent) => {
|
||||
if (ev.key === "s") { // TODO: remove
|
||||
ev.preventDefault();
|
||||
lookupBarcode("075021370814");
|
||||
return;
|
||||
} else if (ev.key === "d") {
|
||||
ev.preventDefault();
|
||||
lookupBarcode("015775150522");
|
||||
return
|
||||
ev.preventDefault();
|
||||
if (ev.key === "F1") { // TODO: remove
|
||||
lookupBarcode("075021370814"); // Breakfast in America; owned
|
||||
} else if (ev.key === "F2") {
|
||||
lookupBarcode("015775150522"); // Crime of the Century; not owned
|
||||
} else if (ev.key === "Enter") {
|
||||
ev.preventDefault();
|
||||
const code = buffer.join("").trim();
|
||||
setBuffer([]); // Reset the buffer
|
||||
lookupBarcode(code);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue