{"size": 1510, "ext": "js", "max_stars_repo_path": "src/polyfills/abort-controller.js", "max_stars_repo_name": "gchicoye/amphtml", "max_stars_repo_stars_event_min_datetime": "2017-12-05T03:37:35.000Z", "max_stars_repo_stars_event_max_datetime": "2020-01-07T16:29:53.000Z", "max_issues_repo_path": "src/polyfills/abort-controller.js", "max_issues_repo_name": "gchicoye/amphtml", "max_issues_repo_issues_event_min_datetime": "2020-10-18T17:19:29.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-02T09:57:00.000Z", "max_forks_repo_path": "src/polyfills/abort-controller.js", "max_forks_repo_name": "cosmin-vi/amphtml", "max_forks_repo_forks_event_min_datetime": "2019-11-15T07:27:57.000Z", "max_forks_repo_forks_event_max_datetime": "2020-01-13T15:28:05.000Z"}
{"max_stars_count": 3, "max_issues_count": 6, "max_forks_count": 2, "avg_line_length": 20.9722222222, "max_line_length": 75, "alphanum_fraction": 0.6417218543}
/**
 * Copyright 2020 The AMP HTML Authors. All Rights Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS-IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

class AbortController {
  /** */
  constructor() {
    /** @const {!AbortSignal} */
    this.signal_ = new AbortSignal();
  }

  /** */
  abort() {
    this.signal_.isAborted_ = true;
  }

  /**
   * @return {!AbortSignal}
   */
  get signal() {
    return this.signal_;
  }
}

class AbortSignal {
  /** */
  constructor() {
    /** @private {boolean} */
    this.isAborted_ = false;
  }

  /**
   * @return {boolean}
   */
  get aborted() {
    return this.isAborted_;
  }
}

/**
 * @param {!Window} win
 */
export function install(win) {
  if (win.AbortController) {
    return;
  }
  Object.defineProperty(win, 'AbortController', {
    configurable: true,
    enumerable: false,
    writable: true,
    value: AbortController,
  });
  Object.defineProperty(win, 'AbortSignal', {
    configurable: true,
    enumerable: false,
    writable: true,
    value: AbortSignal,
  });
}
