update index.js

This commit is contained in:
naielv
2025-08-11 22:04:59 +02:00
parent fe5c54ff3e
commit b07dcd8683

View File

@@ -15,16 +15,18 @@ PAGES.index = {
<h1>Buscar con Aztec</h1> <h1>Buscar con Aztec</h1>
<div id="${qrscan}"></div> <div id="${qrscan}"></div>
<br><br>`; <br><br>`;
const html5QrCode = new Html5Qrcode( var html5QrcodeScanner = new Html5QrcodeScanner(
qrscan, { formatsToSupport: [Html5QrcodeSupportedFormats.AZTEC] }); qrscan, { fps: 10, qrbox: 250 });
const qrCodeSuccessCallback = (decodedText, decodedResult) => {
/* handle success */
alert(decodedText)
html5QrCode.stop()
};
const config = { fps: 10, qrbox: { width: 250, height: 250 } };
// If you want to prefer front camera function onScanSuccess(decodedText, decodedResult) {
html5QrCode.start({ facingMode: "user" }, config, qrCodeSuccessCallback); // Handle on success condition with the decoded text or result.
alert(`Scan result: ${decodedText}`, decodedResult);
// ...
html5QrcodeScanner.clear();
// ^ this will stop the scanner (video feed) and clear the scan area.
}
html5QrcodeScanner.render(onScanSuccess);
} }
}; }