gruhn / vue-qrcode-reader

A set of Vue.js components for detecting and decoding QR codes.
https://gruhn.github.io/vue-qrcode-reader
MIT License
2.03k stars 330 forks source link

Feature Request: Loading spinner for camera area. #396

Closed rogadev closed 6 months ago

rogadev commented 6 months ago

In my testing of this package, it takes the camera about half a second to load up on most computers/devices that I tested. I would love to display a loading spinner, skeleton shadow, or other form of loading indicator to display the loading state of the camera. The best idea I could come up with off the top of my head is a 500ms timeout, but surely there is a better way. Maybe another method for onLoaded that I can use to toggle state to conditionally render a loading spinner?

Awesome package, though. Fast, effective, accurate, and so simple to setup and use - thank you for your hard work. 🙏

rogadev commented 6 months ago

My apologies! You have it there, already. const emit = defineEmits(['detect', 'camera-on', 'camera-off', 'error'])

I throw a handler for the @cameraOn event and I've got what I need. You rock! :)

gruhn commented 6 months ago

FYI: if you haven't seen it, there is also a demo: https://vue-qrcode-reader.netlify.app/demos/LoadingIndicator.html