-
Notifications
You must be signed in to change notification settings - Fork 0
Use Barcode Detection API #9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #9 +/- ##
========================================
- Coverage 1.13% 0.87% -0.26%
========================================
Files 2 3 +1
Lines 88 114 +26
Branches 15 18 +3
========================================
Hits 1 1
- Misses 87 113 +26
Continue to review full report in Codecov by Sentry.
🚀 New features to boost your workflow:
|
@@ -46,6 +48,7 @@ export default { | |||
|
|||
// Constants | |||
let scanner = null; | |||
const abortController = new AbortController(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that if this component can do more than one scan (before it has to go out of scope or get cleaned up or whatever by Vue), then we'll need a new AbortController
for each scan. Otherwise it will always abort after the first abort and never scan again.
components/BarcodeScanner.vue
Outdated
const {signal} = abortController; | ||
const barcodes = await detectBarcodes({barcodeDetector, video, signal}); | ||
const [result] = barcodes; | ||
if(result?.format && result?.rawValue) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think it's possible for result
to be undefined/falsey now with our new design, i.e., detectBarcodes
always returns 1 or more barcodes. So we can simplify this and just use the result, I'd think.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approving with some suggestions to be applied that I'll double check before merging and releasing. Thanks!
Co-authored-by: Dave Longley <[email protected]>
Resolves - use Barcode Detection API
What kind of change does this PR introduce?
What is the current behavior?
What is the new behavior?
Does this PR introduce a breaking change?
How has this been tested?
Screenshots: