40 lines
1.3 KiB
JavaScript
40 lines
1.3 KiB
JavaScript
"use strict";
|
|
// Copyright (c) .NET Foundation. All rights reserved.
|
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
// Rough polyfill of https://developer.mozilla.org/en-US/docs/Web/API/AbortController
|
|
// We don't actually ever use the API being polyfilled, we always use the polyfill because
|
|
// it's a very new API right now.
|
|
// Not exported from index.
|
|
/** @private */
|
|
var AbortController = /** @class */ (function () {
|
|
function AbortController() {
|
|
this.isAborted = false;
|
|
this.onabort = null;
|
|
}
|
|
AbortController.prototype.abort = function () {
|
|
if (!this.isAborted) {
|
|
this.isAborted = true;
|
|
if (this.onabort) {
|
|
this.onabort();
|
|
}
|
|
}
|
|
};
|
|
Object.defineProperty(AbortController.prototype, "signal", {
|
|
get: function () {
|
|
return this;
|
|
},
|
|
enumerable: true,
|
|
configurable: true
|
|
});
|
|
Object.defineProperty(AbortController.prototype, "aborted", {
|
|
get: function () {
|
|
return this.isAborted;
|
|
},
|
|
enumerable: true,
|
|
configurable: true
|
|
});
|
|
return AbortController;
|
|
}());
|
|
exports.AbortController = AbortController;
|
|
//# sourceMappingURL=AbortController.js.map
|