{"size": 1090, "ext": "js", "max_stars_repo_path": "src/aom/model.js", "max_stars_repo_name": "jurokapsiar/acc-snapshot", "max_stars_repo_stars_event_min_datetime": "2019-08-08T21:44:22.000Z", "max_stars_repo_stars_event_max_datetime": "2019-11-14T09:39:01.000Z", "max_issues_repo_path": "src/aom/model.js", "max_issues_repo_name": "jurokapsiar/acc-snapshot", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/aom/model.js", "max_forks_repo_name": "jurokapsiar/acc-snapshot", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": 2, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 25.9523809524, "max_line_length": 115, "alphanum_fraction": 0.6449541284}
export default class AOMModel {
  constructor() {
    this.firstChild = null;
    this.nextSibling = null;
    this.accNodePromise = null;
    this.accNode = null;
    this.domNode = null;
    this.name = null;
    this.offset = 0;
    this.promisses = [];
  }

  processDOM(node) {

    if (!window.getComputedAccessibleNode) {
      throw "acc-snapshot requires AOM to be enabled. See http://wicg.github.io/aom/caniuse.html for instructions."
    }

    this.domNode = node;
    if (node.nodeType === 1) {
      this.accNodePromise = window
        .getComputedAccessibleNode(node)
        .then(accNode => (this.accNode = accNode));
      this.promisses.push(this.accNodePromise);
    }

    if (node.firstChild) {
      this.firstChild = new AOMModel();
      const promisses = this.firstChild.processDOM(node.firstChild);
      this.promisses.push(promisses);
    }

    if (node.nextSibling) {
      this.nextSibling = new AOMModel();
      const promisses = this.nextSibling.processDOM(node.nextSibling);
      this.promisses.push(promisses);
    }

    return this.promisses;
  }
}
