1.0.1 • Published 9 years ago
yqrreader v1.0.1
yQrReader
A thiny wrapper around edi9999/jsqrcode, because a live QR Reader is pretty cool, right?
NOTE: Due to some browser restrictions, access to camera requires an https
connection (being connected to localhost also works)
Install
% npm i --save yqrreaderExample of use:
// es6
import { yQrReader } from 'yQrReader'
const camera = document.querySelector("div#camera");
yQrReader(camera)
.then(data => console.log("Hooray!", data))
;Requirements
- Promises
- es6
navigator.mediaDevices.getUserMedia-- obviously- canvas support
Please, mind that yQrReader is written in es6, so you may require a tool (like'
babel) to translate it back to es5.
For that puorpose, you'll find a compiled version (dist/yQrReader.js) which
can be included in a plain html page (see dist/sample.html as reference).
You can also compile it by yourself: simply install the dev-deps of this
package and run grunt build.
See it live! https://omar-polo.github.io/pages/yQrReader/
Todo:
- customize delay interval
- improve a bit the function that takes a photo from the camera?