{"size": 1312, "ext": "js", "max_stars_repo_path": "samples/playground/demo.js", "max_stars_repo_name": "Scarygami/chrome.ev3", "max_stars_repo_stars_event_min_datetime": "2018-05-23T16:33:46.000Z", "max_stars_repo_stars_event_max_datetime": "2018-05-23T16:33:46.000Z", "max_issues_repo_path": "samples/playground/demo.js", "max_issues_repo_name": "Scarygami/chrome.ev3", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "samples/playground/demo.js", "max_forks_repo_name": "Scarygami/chrome.ev3", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": 1, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 29.1555555556, "max_line_length": 109, "alphanum_fraction": 0.581554878}
(function (global) {
  "use strict";

  var
    ev3 = global.ev3,
    con = global.console,
    doc = global.document,
    status = doc.getElementById("status"),
    main = doc.getElementById("main"),
    controls = doc.getElementById("controls"),
    connect = doc.getElementById("connect");

  if (!ev3) {
    status.textContent = "Something went terribly wrong, EV3 API not loaded...";
    return;
  }
  
  status.textContent = "Waiting for EV3 API to become ready...";
  ev3.onReady.add(function () {
    var devices;
    status.textContent ="EV3 API ready, searching for devices...!";
    
    devices = ev3.getDevices();
    if (devices.length > 0) {
      status.textContent = "EV3 found! Controls enabled!";
      main.style.display = "block";
      connect.onclick = function () {
        connect.disabled = true;
        ev3.connect(0, function (error) {
          if (!!error) {
            status.textContent = error;
            connect.disabled = false;
          } else {
            // initialize();
            status.textContent = "EV3 connected, waiting for input...";
            controls.style.display = "block";
          }
        });
      };
    } else {
      status.textContent = "No devices found, make sure to pair with your EV3 first, then restart this app.";
    }
  });

}(this));