Last active
December 23, 2015 23:08
-
-
Save cdeutsch/6707524 to your computer and use it in GitHub Desktop.
Wire up Scan button in Xamarin.Web.BarcodeSample app
This file contains 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
<script type="text/javascript" src="~/scripts/mt.js"></script> | |
<script type="text/javascript"> | |
$(document).ready(function () { | |
// listen for scan finished event triggered from native code. | |
Mt.App.addEventListener('scanComplete', function (data) { | |
if (data && data.code) { | |
if (confirm('Use the code ' + data.code + '?')) { | |
$('#PromoCode').val(data.code); | |
} | |
} | |
}); | |
$('#scanBarcode').on('click', function (e) { | |
e.preventDefault(); | |
// fire event in native code. | |
Mt.App.fireEvent('scanBarcode', {}); | |
}); | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment