Strange behavior when overriding a cordova function


#1

Hi everybody,

I’m working on an app with a barcode scanner and, of course, it’s not working on my desktop. So I mock the barcode scanner behavior with this code :

var cordova = {
    plugins: {
        barcodeScanner: {
            scan: function(success, fail){
                var barcode = prompt('barcode :');
                if(barcode == null){
                    success({ text: null, format: null, cancelled: true });
                } else {
                   success({ text: barcode, format: 'text', cancelled: false });
                }
            }
        }
    }
};

With all alpha versions of ionic it worked great, but now with the beta version this code makes Ionic send click events twice :frowning: (I didn’t tried for other side effects).
Here is a codepen sample : http://codepen.io/anon/pen/JrpuB

To me it’s probably un bug in Ionic, what do you think ?
And do you have any idea for a workaround ?


#2

Certainly looks like a bug. I tried the nightly as well with the same result.

I opened issue # 1022 : https://github.com/driftyco/ionic/issues/1022


#3

As usual, Adam solved this in a heartbeat. This is fixed in the nightly.


#4

Apparently, this bug still happens on 1.0.0-rc.5.

Please see details on GitHub