phonegap-plugin-barcodescanner
Advanced tools
Comparing version 6.0.0 to 6.0.1
{ | ||
"name": "phonegap-plugin-barcodescanner", | ||
"version": "6.0.0", | ||
"version": "6.0.1", | ||
"description": "You can use the BarcodeScanner plugin to scan different types of barcodes (using the device's camera) and get the metadata encoded in them for processing within your application.", | ||
@@ -5,0 +5,0 @@ "cordova": { |
@@ -554,3 +554,3 @@ /* | ||
function checkCancelled() { | ||
if (BarcodeReader.scanCancelled) { | ||
if (BarcodeReader.scanCancelled || BarcodeReader.suspended) { | ||
throw new Error('Canceled'); | ||
@@ -591,4 +591,8 @@ } | ||
}, function (error) { | ||
// Suppress null result (cancel) on suspending | ||
if (BarcodeReader.suspended) { | ||
return; | ||
} | ||
destroyPreview(); | ||
if (error.message == 'Canceled') { | ||
@@ -627,8 +631,35 @@ success({ | ||
function suspend(args) { | ||
BarcodeReader.suspended = true; | ||
if (args) { | ||
args.setPromise(BarcodeReader.destroyPreview() | ||
.then(waitForScanEnd, waitForScanEnd)); | ||
} else { | ||
BarcodeReader.destroyPreview(); | ||
} | ||
} | ||
function resume() { | ||
BarcodeReader.suspended = false; | ||
module.exports.scan(BarcodeReader.scanCallArgs.success, BarcodeReader.scanCallArgs.fail, BarcodeReader.scanCallArgs.args); | ||
} | ||
function onVisibilityChanged() { | ||
if (document.visibilityState === 'hidden' | ||
&& BarcodeReader.videoPreviewIsVisible && BarcodeReader.videoPreviewIsVisible() && BarcodeReader.destroyPreview) { | ||
suspend(); | ||
} else if (BarcodeReader.suspended) { | ||
resume(); | ||
} | ||
} | ||
// Windows 8.1 projects | ||
document.addEventListener('msvisibilitychange', onVisibilityChanged); | ||
// Windows 10 projects | ||
document.addEventListener('visibilitychange', onVisibilityChanged); | ||
// About to be suspended | ||
app.addEventListener('checkpoint', function (args) { | ||
if (BarcodeReader.videoPreviewIsVisible && BarcodeReader.videoPreviewIsVisible() && BarcodeReader.destroyPreview) { | ||
BarcodeReader.suspended = true; | ||
args.setPromise(BarcodeReader.destroyPreview() | ||
.then(waitForScanEnd, waitForScanEnd)); | ||
suspend(args); | ||
} | ||
@@ -640,4 +671,3 @@ }); | ||
if (BarcodeReader.suspended) { | ||
BarcodeReader.suspended = false; | ||
module.exports.scan(BarcodeReader.scanCallArgs.success, BarcodeReader.scanCallArgs.fail, BarcodeReader.scanCallArgs.args); | ||
resume(); | ||
} | ||
@@ -644,0 +674,0 @@ }, false); |
Sorry, the diff of this file is not supported yet
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
6509850
1665
0