{"size": 1053, "ext": "js", "max_stars_repo_path": "test/unit/utils/html_helper.js", "max_stars_repo_name": "AntonioMA/firefoxos-loop-client", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "test/unit/utils/html_helper.js", "max_issues_repo_name": "AntonioMA/firefoxos-loop-client", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "test/unit/utils/html_helper.js", "max_forks_repo_name": "AntonioMA/firefoxos-loop-client", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 22.4042553191, "max_line_length": 80, "alphanum_fraction": 0.6429249763}
'use strict';

(function(global) {

  var requestedFragments = {};

  var requestedJS = {};

  global.requireElement = (filename, id) => {
    if (requestedFragments[filename]) {
      return;
    }

    requestedFragments[filename] = true;

    var xhr = new XMLHttpRequest();
    xhr.open('GET', filename, false /* intentional sync */);
    xhr.send();

    var htmlFragment = document.createElement('div');
    htmlFragment.innerHTML = xhr.responseText;

    var container = document.createElement('div');
    if (id) {
      container.id = id;
    }
    container.innerHTML = htmlFragment.querySelector('template').innerHTML;

    document.body.appendChild(container);
  };

  global.require = (filename, callback) => {
    if (requestedJS[filename]) {
      return;
    }

    requestedJS[filename] = true;

    var script = document.createElement('script');
    script.src = filename;
    script.async = false;
    typeof callback === 'function' && script.addEventListener('load', callback);
    document.head.appendChild(script);
  };

}(this));
