mirror of
https://github.com/cnwhy/QRCode-decode.git
synced 2026-08-12 20:31:40 +08:00
v0.0.1
This commit is contained in:
+5
-7
@@ -1,5 +1,5 @@
|
||||
|
||||
var decode = require('./src/QRCodeDecode');
|
||||
var qrDecode = require('./src/QRCodeDecode');
|
||||
var decodeByDom = function (dom) {
|
||||
var canvas = document.createElement("canvas")
|
||||
var ctx = canvas.getContext('2d')
|
||||
@@ -7,7 +7,7 @@ var decodeByDom = function (dom) {
|
||||
canvas.height = dom.height;
|
||||
ctx.drawImage(dom, 0, 0, canvas.width, canvas.height);
|
||||
var data = ctx.getImageData(0, 0, canvas.width, canvas.height);
|
||||
return decode(data)
|
||||
return qrDecode(data)
|
||||
}
|
||||
|
||||
var decodeByUrl = (src, cb) => {
|
||||
@@ -24,8 +24,6 @@ var decodeByUrl = (src, cb) => {
|
||||
img.onerror = cb;
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
decodeByImageDate: decode,
|
||||
decodeByDom: decodeByDom,
|
||||
decodeByUrl: decodeByUrl
|
||||
}
|
||||
qrDecode.decodeByDom = decodeByDom;
|
||||
qrDecode.decodeByUrl = decodeByUrl;
|
||||
module.exports = qrDecode;
|
||||
Reference in New Issue
Block a user