Socket
Socket
Sign inDemoInstall

vue-qrcode-reader

Package Overview
Dependencies
Maintainers
1
Versions
135
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vue-qrcode-reader - npm Package Compare versions

Comparing version 0.4.0 to 0.5.0

src/scanner.js

2

package.json
{
"name": "vue-qrcode-reader",
"description": "A Vue.js component, accessing the device camera and allowing users to read QR-Codes, within the browser",
"version": "0.4.0",
"version": "0.5.0",
"author": {

@@ -6,0 +6,0 @@ "name": "Niklas Gruhn",

@@ -6,3 +6,3 @@ # vue-qrcode-reader

A Vue.js component, accessing the device camera and allowing users to read QR-Codes, within the browser. It utilizes WebRTC, which only works in secure context (i.e. **HTTPS**).
A Vue.js component, accessing the device camera and allowing users to read QR codes, within the browser. Make sure to use it secure context (i.e. **HTTPS**).

@@ -13,6 +13,8 @@ [Demo](https://gruhn.github.io/vue-qrcode-reader-demo) | [Source](https://github.com/gruhn/vue-qrcode-reader-demo/blob/master/src/components/TheQrcodeReaderDemo.vue)

As soon as it's mounted, this component will ask the user for permisson to access his device camera (back camera if available). Even if the user granted permission earlier, some time might pass between mounting and the moment the camera stream is loaded. Until then you might want to show a preloader. Just listen to the `stream-loaded` event.
As soon as it's mounted, this component will ask the user for permisson to access his device camera (back camera if available). If the user denies camera access, the `permission-deny` event is fired. You can't really ask for permissons twice so you should tell the user why you need it.
Once the stream is loaded, it is displayed and continuously scanned for QR-Codes. Results are indicated by the `decode` event.
Even if the user granted permission earlier, some time might pass between mounting and the moment the camera stream is loaded. Until then you might want to show a preloader. Just listen to the `stream-loaded` event.
Once the stream is loaded, it is displayed and continuously scanned for QR codes. Results are indicated by the `decode` event.
```html

@@ -23,11 +25,10 @@ <qrcode-reader @decode="onDecode"></qrcode-reader>

methods: {
onDecode (event) {
event.content // string of read data or null
event.location // set of QR-Code module positions or null
onDecode (content) {
// ...
}
}
```
If the user denies camera access, the `permission-deny` event is fired. You can't really ask for permissons twice so you should tell the user why you need it.
`decode` only carries the string, encoded by the QR code. If you also want to track the QR codes position, listen for the `locate` event. It is fired whenever QR code modules are detected at certain positions and when those positions change. It's payload contains an array of coordinates (in the form of `{ x: 278, y: 346 }`) for each detected module. Or an empty array if nothing is detected anymore.
Distributed content will overlay the camera stream, wrapped in a `position: absolute` container. You can use this for example to highlight the detected position of QR-Code modules.
Distributed content will overlay the camera stream, wrapped in a `position: absolute` container. You can use this for example to highlight the detected position of QR codes.

@@ -40,3 +41,3 @@ ```html

With the `paused` prop you can prevent further `decode` propagation. Useful for example if you're only interested in the first result.
With the `paused` prop you can prevent further `decode` and `locate` propagation. Useful for example if you're only interested in the first result. This will also freeze the camera stream.
```html

@@ -53,3 +54,3 @@ <qrcode-reader @decode="onDecode" :paused="paused"></qrcode-reader>

methods: {
onDecode (event) {
onDecode (content) {
this.paused = true

@@ -60,11 +61,10 @@ // ...

```
There is also a `no-support` event which is fired when the users browser lacks support for Canvas, WebRTC or if the page is not served over HTTPS. Since iOS 11 release, all major browsers support WebRTC. However, you probably want to install a shim like [webrtc-adapter](https://github.com/webrtc/adapter) anyway.
There is also a `no-support` event which is fired when the users browser lacks support for Canvas, WebRTC or if the page is not served over HTTPS. Since iOS 11 release, WebRTC is finally even supported in Safari. However, to optimize browser support you should install the [webrtc-adapter](https://github.com/webrtc/adapter) shim.
# Installation
```
yarn add vue-qrcode-reader
yarn add vue-qrcode-reader webrtc-adapter
# or
npm install --save vue-qrcode-reader
npm install --save vue-qrcode-reader webrtc-adapter
```

@@ -191,4 +191,8 @@

## License
# Contribution
All contributions are welcome. If you wish to contribution code, make sure your editor has editorconfig installed.
# License
[MIT](http://opensource.org/licenses/MIT)

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc