<commit_before>var EbillApplication = {
  results: [],
  resultsElement: document.querySelector('.results'),

  writeResults: function writeResults() {
    this.resultsElement.innerHTML = '';
    this.results.forEach(function forEachResult(result) {
      this.resultsElement.innerHTML += result;
    }.bind(this));
  },

  onDeviceReady: function onDeviceReady() {
    document.querySelector('.button').addEventListener('click', function onClick() {
      cordova.plugins.barcodeScanner.scan(
        function success(result) {
          this.results.unshift('<p>Result: ' + result + '</p>');
          this.writeResults();
        }.bind(this),
        function failed(error) {
          this.results.unshift('<p>Error: ' + error + '</p>');
          this.writeResults();
        }.bind(this)
      );
    }.bind(this));
  }
};

document.addEventListener('deviceready', EbillApplication.onDeviceReady, false);
<commit_msg>Switched to singleton<commit_after>var EbillApplication = {
  results: [],
  resultsElement: document.querySelector('.results'),

  writeResults: function writeResults() {
    EbillApplication.resultsElement.innerHTML = '';
    EbillApplication.results.forEach(function forEachResult(result) {
      EbillApplication.resultsElement.innerHTML += result;
    });
  },

  onDeviceReady: function onDeviceReady() {
    document.querySelector('.button').addEventListener('click', function onClick() {
      cordova.plugins.barcodeScanner.scan(
        function success(result) {
          EbillApplication.results.unshift('<p>Result: ' + result + '</p>');
          EbillApplication.writeResults();
        },
        function failed(error) {
          EbillApplication.results.unshift('<p>Error: ' + error + '</p>');
          EbillApplication.writeResults();
        }
      );
    }.bind(this));
  }
};

document.addEventListener('deviceready', EbillApplication.onDeviceReady, false);

{'fraction_non_alphanumeric': 0.14735186156266386, 'fraction_numerical': 0.0, 'mean_word_length': 3.457943925233645, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1626725', 'n_tokens_mistral': 531, 'n_tokens_neox': 509, 'n_words': 77}