AbortController.js 983 B

1234567891011121314151617181920212223242526272829303132
  1. "use strict";
  2. // Licensed to the .NET Foundation under one or more agreements.
  3. // The .NET Foundation licenses this file to you under the MIT license.
  4. Object.defineProperty(exports, "__esModule", { value: true });
  5. exports.AbortController = void 0;
  6. // Rough polyfill of https://developer.mozilla.org/en-US/docs/Web/API/AbortController
  7. // We don't actually ever use the API being polyfilled, we always use the polyfill because
  8. // it's a very new API right now.
  9. // Not exported from index.
  10. /** @private */
  11. class AbortController {
  12. constructor() {
  13. this._isAborted = false;
  14. this.onabort = null;
  15. }
  16. abort() {
  17. if (!this._isAborted) {
  18. this._isAborted = true;
  19. if (this.onabort) {
  20. this.onabort();
  21. }
  22. }
  23. }
  24. get signal() {
  25. return this;
  26. }
  27. get aborted() {
  28. return this._isAborted;
  29. }
  30. }
  31. exports.AbortController = AbortController;
  32. //# sourceMappingURL=AbortController.js.map