Skip to content

Commit

Permalink
* testing if qr-canvas is not null before calling decode function to …
Browse files Browse the repository at this point in the history
…prevent errors in the browser logs, incrementing version number
  • Loading branch information
dev-mansonthomas committed Mar 19, 2018
1 parent 135129c commit 46c072b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"name": "angular-qr-scanner-updated",
"version": "1.0.2",
"version": "1.0.3",
"devDependencies": {
"grunt": "~0.4.5",
"grunt-contrib-uglify": "~0.9.1",
"grunt-contrib-watch": "~0.6.1"
},
"dependencies": {
"angular": "~1.6.6",
"angular": "~1.6.8",
"jsqrcode": "0.0.6"
},
"main": "qr-scanner-u.js"
Expand Down
9 changes: 6 additions & 3 deletions qr-scanner-u.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,17 @@ angular.module('qrScannerU', ["ng"]).directive('qrScannerU', ['$interval', '$win
context.drawImage(video, 0, 0, 307,250);
try
{
qrcode.decode();
if(document.getElementById("qr-canvas")!=null)
{
qrcode.decode();
}
}
catch(e)
{
scope.ngError({error: e});
}
}
}
};

var successCallback = function(stream)
{
Expand All @@ -59,7 +62,7 @@ angular.module('qrScannerU', ["ng"]).directive('qrScannerU', ['$interval', '$win
scope.video = video;
video.play();
stopScan = $interval(scan, 500);
}
};

// Call the getUserMedia method with our callback functions
if (navigator.getUserMedia)
Expand Down

0 comments on commit 46c072b

Please sign in to comment.