source: trip-planner-front/node_modules/rxjs/_esm2015/internal/AsyncSubject.js@ 6a3a178

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

initial commit

  • Property mode set to 100644
File size: 1.1 KB
Line 
1import { Subject } from './Subject';
2import { Subscription } from './Subscription';
3export class AsyncSubject extends Subject {
4 constructor() {
5 super(...arguments);
6 this.value = null;
7 this.hasNext = false;
8 this.hasCompleted = false;
9 }
10 _subscribe(subscriber) {
11 if (this.hasError) {
12 subscriber.error(this.thrownError);
13 return Subscription.EMPTY;
14 }
15 else if (this.hasCompleted && this.hasNext) {
16 subscriber.next(this.value);
17 subscriber.complete();
18 return Subscription.EMPTY;
19 }
20 return super._subscribe(subscriber);
21 }
22 next(value) {
23 if (!this.hasCompleted) {
24 this.value = value;
25 this.hasNext = true;
26 }
27 }
28 error(error) {
29 if (!this.hasCompleted) {
30 super.error(error);
31 }
32 }
33 complete() {
34 this.hasCompleted = true;
35 if (this.hasNext) {
36 super.next(this.value);
37 }
38 super.complete();
39 }
40}
41//# sourceMappingURL=AsyncSubject.js.map
Note: See TracBrowser for help on using the repository browser.