Package Exports
- qrcode-reader
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (qrcode-reader) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
JavaScript QRCode reader for HTML5 enabled browser.
This is a port of Lazarsoft’s qrcode reader
Installation
npm install qrcode-readerUsage
QrCode=require(‘qrcode-reader’);Create a new instance of QrCode:
qr= new QrCode();Set it's callback to a custom function
qr.callback= function(result){alert(result)}Decode an image by it's URL or Data URI:
qr.decode(url or DataURL);Decode an image by context.getImageData: Works with web workers.
var context = canvas.getContext("2d");
var data = context.getImageData(0, 0, width, height);
qr.decode(data);Decode from canvas with "qr-canvas" ID:
qr.decode()Building it yourself
If you want, you can build the script yourself.
First clone the repository, then from the directory of this repository, do :
npm install
gulp compileYou will have one jsfile called index.js that you can run from node.
You can then run the tests by running
npm testMake it work in the browser
After building yourself the script index.js, you can do :
npm install --global browserify
browserify -o qrcode.js -s QrCode index.jsThis way if you do in your HTML :
<script src="qrcode.js"></script>
you will have access to the global variable `QrCode`