{"size": 751, "ext": "js", "max_stars_repo_path": "lib/is-cordova.js", "max_stars_repo_name": "reekoheek/xin-cordova", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "lib/is-cordova.js", "max_issues_repo_name": "reekoheek/xin-cordova", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "lib/is-cordova.js", "max_forks_repo_name": "reekoheek/xin-cordova", "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": 21.4571428571, "max_line_length": 92, "alphanum_fraction": 0.6537949401}
async function isCordova () {
  if (!window.cordova) {
    return false;
  }

  if (window.CORDOVA_STATUS) {
    return window.CORDOVA_STATUS;
  }

  if (window.device) {
    window.CORDOVA_STATUS = window.device.available;
    return window.CORDOVA_STATUS;
  }

  return await new Promise(resolve => {
    let listener = () => {
      removeListener();
      resolve(true);
    };
    let removeListener = () => document.removeEventListener('deviceready', listener, false);

    document.addEventListener('deviceready', listener, false);

    setTimeout(() => {
      removeListener();
      window.CORDOVA_STATUS = false;
      resolve(window.CORDOVA_STATUS);
    }, isCordova.timeout);
  });
}

isCordova.timeout = 3000;

export default isCordova;
