<commit_before>var QRClient = function() {
  var worker = new Worker('/scripts/jsqrcode/qrworker.js');
  var barcodeDetector;

    
  var currentCallback;

  this.decode = function(context, callback) {
    // Temporary hack because 
    if(BarcodeDetector) {
      barcodeDetector = new BarcodeDetector();
      // barcodeDetector.detect(context.canvas)
      // .then(barcodes => {
      //   // return the first barcode.
      //   if(barcodes.length > 0) {
      //     callback(barcodes[0].rawValue);
      //   }
      //   else {
      //     callback();
      //   }   
      // })
      // .catch(err => { 
      //   callback();
      //   console.error(err)
      // });
    }
    else {
      // A frame has been captured.
      var canvas = context.canvas;
      var imageData = context.getImageData(0, 0, canvas.width, canvas.height);
      worker.postMessage(imageData);
        currentCallback = callback;
    }
  };

  worker.onmessage = function(e) {
    if(currentCallback) {
      currentCallback(e.data);
    }
  };
 };<commit_msg>Letting the site configure bardcode detection api to ttest<commit_after>var QRClient = function() {
  var worker = new Worker('/scripts/jsqrcode/qrworker.js');
  var barcodeDetector;

    
  var currentCallback;

  this.decode = function(context, callback) {
    // Temporary hack because 
    if(BarcodeDetector && location.hash === "#canvasdebug") {
      barcodeDetector = new BarcodeDetector();
      barcodeDetector.detect(context.canvas)
      .then(barcodes => {
        // return the first barcode.
        if(barcodes.length > 0) {
          callback(barcodes[0].rawValue);
        }
        else {
          callback();
        }   
      })
      .catch(err => { 
        callback();
        console.error(err)
      });
    }
    else {
      // A frame has been captured.
      var canvas = context.canvas;
      var imageData = context.getImageData(0, 0, canvas.width, canvas.height);
      worker.postMessage(imageData);
        currentCallback = callback;
    }
  };

  worker.onmessage = function(e) {
    if(currentCallback) {
      currentCallback(e.data);
    }
  };
 };
{'fraction_non_alphanumeric': 0.13218122372723026, 'fraction_numerical': 0.0037365716954694066, 'mean_word_length': 2.051282051282051, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, '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': '1423619', 'n_tokens_mistral': 662, 'n_tokens_neox': 645, 'n_words': 124}