Skip to content

Commit 6b621b2

Browse files
committed
Apply code review suggestions.
1 parent 545f7fa commit 6b621b2

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

components/BarcodeScanner.vue

+8-9
Original file line numberDiff line numberDiff line change
@@ -166,23 +166,22 @@ export default {
166166
167167
function startBarcodeDetection() {
168168
// Get video element
169-
const videoElement = document.querySelector(
169+
const video = document.querySelector(
170170
'#dce-video-container > video'
171171
);
172172
const {BarcodeDetector} = globalThis;
173173
// Check if BarcodeDetector is supported
174174
if(!BarcodeDetector) {
175175
alert('Barcode Detector is not supported in this browser.');
176176
return;
177-
} else {
178-
const barcodeDetector = new BarcodeDetector({
179-
formats: formatsToSupport
180-
});
181-
// Start the detection loop
182-
videoElement.requestVideoFrameCallback(() =>
183-
emitScanResult({barcodeDetector, video: videoElement})
184-
);
185177
}
178+
const barcodeDetector = new BarcodeDetector({
179+
formats: formatsToSupport
180+
});
181+
// Start the detection loop
182+
video.requestVideoFrameCallback(
183+
() => emitScanResult({barcodeDetector, video})
184+
);
186185
}
187186
188187
// Update camera zoom

0 commit comments

Comments
 (0)