Strange behavior when overriding a cordova function

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 :

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

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

I opened issue # 1022 :

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

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

Please see details on GitHub