Skip to content

Instantly share code, notes, and snippets.

@brianleroux
Created September 11, 2014 22:04
Show Gist options
  • Save brianleroux/607a04228bb4aedfbb73 to your computer and use it in GitHub Desktop.
Save brianleroux/607a04228bb4aedfbb73 to your computer and use it in GitHub Desktop.
<script src=cordova.js></script>
<script>
document.addEventListener('deviceready', function() {
cordova.plugins.barcodeScanner.scan(
function (result) {
alert("We got a barcode\n" +
"Result: " + result.text + "\n" +
"Format: " + result.format + "\n" +
"Cancelled: " + result.cancelled);
},
function (error) {
alert("Scanning failed: " + error);
}
);
})
</script>
~
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment