source: trip-planner-front/node_modules/rxjs/_esm5/internal/AsyncSubject.js@ eed0bf8

Last change on this file since eed0bf8 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 1.6 KB
Line 
1/** PURE_IMPORTS_START tslib,_Subject,_Subscription PURE_IMPORTS_END */
2import * as tslib_1 from "tslib";
3import { Subject } from './Subject';
4import { Subscription } from './Subscription';
5var AsyncSubject = /*@__PURE__*/ (function (_super) {
6 tslib_1.__extends(AsyncSubject, _super);
7 function AsyncSubject() {
8 var _this = _super !== null && _super.apply(this, arguments) || this;
9 _this.value = null;
10 _this.hasNext = false;
11 _this.hasCompleted = false;
12 return _this;
13 }
14 AsyncSubject.prototype._subscribe = function (subscriber) {
15 if (this.hasError) {
16 subscriber.error(this.thrownError);
17 return Subscription.EMPTY;
18 }
19 else if (this.hasCompleted && this.hasNext) {
20 subscriber.next(this.value);
21 subscriber.complete();
22 return Subscription.EMPTY;
23 }
24 return _super.prototype._subscribe.call(this, subscriber);
25 };
26 AsyncSubject.prototype.next = function (value) {
27 if (!this.hasCompleted) {
28 this.value = value;
29 this.hasNext = true;
30 }
31 };
32 AsyncSubject.prototype.error = function (error) {
33 if (!this.hasCompleted) {
34 _super.prototype.error.call(this, error);
35 }
36 };
37 AsyncSubject.prototype.complete = function () {
38 this.hasCompleted = true;
39 if (this.hasNext) {
40 _super.prototype.next.call(this, this.value);
41 }
42 _super.prototype.complete.call(this);
43 };
44 return AsyncSubject;
45}(Subject));
46export { AsyncSubject };
47//# sourceMappingURL=AsyncSubject.js.map
Note: See TracBrowser for help on using the repository browser.