Skip to content
Snippets Groups Projects
Commit 7462d881 authored by c-tim's avatar c-tim
Browse files

Merge branch 'debounceScanner' into 'staging'

feat(scanner): Debounce scanner

See merge request hanfi/bgp_worker!13
parents 0d2dcad7 a9ce7356
Branches
No related tags found
2 merge requests!18Merge Staging into Main,!13feat(scanner): Debounce scanner
This diff is collapsed.
import {
Html5QrcodeScanner,
Html5QrcodeScannerState,
Html5QrcodeSupportedFormats
} from "html5-qrcode";
import {
......@@ -201,7 +202,16 @@ async function handleQrError(msg, err){
console.log("Qrcode Error: ", msg, err);
}
function debounceScanner() {
if(scanner.getState() != Html5QrcodeScannerState.SCANNING) {
return;
}
scanner.pause(false);
setTimeout(function() {if(scanner.getState() == Html5QrcodeScannerState.PAUSED){scanner.resume();}}, 1000);
}
async function handleItemScanResult(item_uuid) {
debounceScanner();
if (item_uuid.length == 36) {
console.log("Trying to add item by uuid (scanned)");
if (item_uuid in received_items) {
......@@ -310,6 +320,7 @@ export async function checkinItems() {
}
async function onRecevierScanSuccess(scannedCode) {
debounceScanner();
var [uuid,signature] = scannedCode.split("/");
console.log("Receiver scan success");
scanner_audio.play();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment