Adds support for scoping callback functions in barcodescanner.js