{"size": 400, "ext": "js", "max_stars_repo_path": "src/assets/js/tools/loadScript.js", "max_stars_repo_name": "mike3run/rt-website", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/assets/js/tools/loadScript.js", "max_issues_repo_name": "mike3run/rt-website", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/assets/js/tools/loadScript.js", "max_forks_repo_name": "mike3run/rt-website", "max_forks_repo_forks_event_min_datetime": "2018-12-14T14:05:13.000Z", "max_forks_repo_forks_event_max_datetime": "2018-12-14T14:05:13.000Z"}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": 1, "avg_line_length": 20.0, "max_line_length": 52, "alphanum_fraction": 0.6325}
/**
 * loadScript create a script tag and execute a cb
 *
 * @param src {String}
 * @param done {Function}
 */
function loadScript (src, done) {
  var js = document.createElement('script');
  js.src = src;
  js.onload = function () {
    done();
  };
  js.onerror = function () {
    done(new Error('Failed to load script ' + src));
  };
  document.head.appendChild(js);
}

export default loadScript
