Re-working the API library functions and files

This commit is contained in:
Scott Idem
2024-05-23 18:20:31 -04:00
parent fa58d1accb
commit 42fef3feb8
17 changed files with 1797 additions and 92 deletions

View File

@@ -63,7 +63,7 @@ onMount(() => {
// navigator.mediaDevices.getUserMedia({video: true})
// .then(get_user_media_success, get_user_media_error);
// console.log('** Element Mounted: ** QR Scanner - getUserMedia in setTimeout');
// console.log('** Element Mounted: ** QR Scanner - getUserMedia in setTimeout');
});
@@ -91,7 +91,7 @@ var get_user_media_success = function(error: any) {
// document.getElementById('qr_scanner_viewfinder').classList.remove('d_none');
} else {
console.log('html5_qr_code not found. Creating new Html5Qrcode...');
debug_info = 'html5_qr_code not found. Creating new Html5Qrcode...';
debug_info = 'html5_qr_code not found. Creating new Html5Qrcode...';
html5_qr_code = new Html5Qrcode(
'qr_scanner_viewfinder', { formatsToSupport: [ Html5QrcodeSupportedFormats.QR_CODE ] }
@@ -101,7 +101,7 @@ var get_user_media_success = function(error: any) {
// html5_qr_code = new Html5Qrcode(
// 'qr_scanner_viewfinder', { formatsToSupport: [ Html5QrcodeSupportedFormats.QR_CODE ] }
// );
debug_info = 'new Html5Qrcode for element id=qr_scanner_viewfinder';
if (start_qr_scanner && 1==2) {
@@ -109,11 +109,11 @@ var get_user_media_success = function(error: any) {
debug_comment = 'Starting QR after 500ms...';
debug_info = 'Ready to start QR scanning! (after 2500ms)';
setTimeout(() => {
console.log('Inside QR scanning timeout after x500ms...');
console.log('Inside QR scanning timeout after x500ms...');
// handle_start_qr_scanning();
handle_start_qr_scanning_trust();
}, 2500);
console.log('Started QR scanning after x500ms...');
console.log('Started QR scanning after x500ms...');
}
// let subject = 'Camera Access Allowed';
@@ -178,7 +178,7 @@ async function handle_start_qr_scanning_trust() {
debug_comment = 'Starting trusting QR scanning...';
debug_info = 'Just start!';
debug_info = 'Just start!';
await html5_qr_code.clear();
html5_qr_code.start({ facingMode: qr_facing_mode }, qr_scan_cfg, handle_qr_scan_success, handle_qr_scan_error)
.then((ignore: any) => {
@@ -236,7 +236,7 @@ async function handle_start_qr_scanning() {
debug_comment = 'Starting QR Scanning...';
debug_info = 'Check the state and start if not started...';
debug_info = 'Check the state and start if not started...';
let current_state = await html5_qr_code.getState()
@@ -278,7 +278,7 @@ async function handle_start_qr_scanning() {
return;
}
}
@@ -312,7 +312,7 @@ async function handle_stop_qr_scanning() {
}
await html5_qr_code.stop();
// let state = html5_qr_code.getState();
// console.log('html5_qr_code state:', state);
@@ -505,7 +505,7 @@ function send_init_confirm_email(subject, message) {
<span class="fas fa-qrcode mx-1"></span>
Start Scanning
</button>
<button
on:click={ () => {
// Select back camera or fail with `OverconstrainedError`.
@@ -516,8 +516,8 @@ function send_init_confirm_email(subject, message) {
Resume
</button>
<button
on:click={handle_stop_qr_scanning}
<button
on:click={handle_stop_qr_scanning}
class="ae_btn__stop btn btn-sm variant-soft-secondary"
>
<span class="fas fa-crosshairs fa-spin opacity-50 m-1"></span>