Created
July 11, 2014 18:37
-
-
Save victorkurauchi/e3912f78a7eee212c1fc to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
return { | |
scannerAvailable: false, | |
scanner: null, | |
isEnabled: function() { | |
if ('plugins' in window && 'barcodeScanner' in window.plugins) { | |
scanner = window.plugins.barcodeScanner; | |
} | |
else if ('barcodeScanner' in window) { | |
scanner = window.barcodeScanner; | |
} | |
else if ('cordova' in window) { | |
// barcodeScanner 1.0 | |
if ('plugins' in cordova && 'barcodeScanner' in cordova.plugins) { | |
scanner = cordova.plugins.barcodeScanner; | |
// barcodeScanner 0.7 | |
} else { | |
scanner = cordova.require("cordova/plugin/BarcodeScanner"); | |
} | |
} | |
if (scanner != null) { | |
this.scannerAvailable = true; | |
} | |
return this.scannerAvailable; | |
}, | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment