Debian Codegraph @

node/rxjs/dist/cjs/internal/AsyncSubject.js

raw
1 "use strict";
2 var __extends = (this && this.__extends) || (function () {
3 var extendStatics = function (d, b) {
4 extendStatics = Object.setPrototypeOf ||
5 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6 function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7 return extendStatics(d, b);
8 };
9 return function (d, b) {
10 if (typeof b !== "function" && b !== null)
11 throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12 extendStatics(d, b);
13 function __() { this.constructor = d; }
14 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15 };
16 })();
17 Object.defineProperty(exports, "__esModule", { value: true });
18 exports.AsyncSubject = void 0;
19 var Subject_1 = require("./Subject");
20 var AsyncSubject = (function (_super) {
21 __extends(AsyncSubject, _super);
22 function AsyncSubject() {
23 var _this = _super !== null && _super.apply(this, arguments) || this;
24 _this._value = null;
25 _this._hasValue = false;
26 _this._isComplete = false;
27 return _this;
28 }
29 AsyncSubject.prototype._checkFinalizedStatuses = function (subscriber) {
30 var _a = this, hasError = _a.hasError, _hasValue = _a._hasValue, _value = _a._value, thrownError = _a.thrownError, isStopped = _a.isStopped, _isComplete = _a._isComplete;
31 if (hasError) {
32 subscriber.error(thrownError);
33 }
34 else if (isStopped || _isComplete) {
35 _hasValue && subscriber.next(_value);
36 subscriber.complete();
37 }
38 };
39 AsyncSubject.prototype.next = function (value) {
40 if (!this.isStopped) {
41 this._value = value;
42 this._hasValue = true;
43 }
44 };
45 AsyncSubject.prototype.complete = function () {
46 var _a = this, _hasValue = _a._hasValue, _value = _a._value, _isComplete = _a._isComplete;
47 if (!_isComplete) {
48 this._isComplete = true;
49 _hasValue && _super.prototype.next.call(this, _value);
50 _super.prototype.complete.call(this);
51 }
52 };
53 return AsyncSubject;
54 }(Subject_1.Subject));
55 exports.AsyncSubject = AsyncSubject;
56 //# sourceMappingURL=AsyncSubject.js.map