source: trip-planner-front/node_modules/rxjs/_esm5/internal/operators/repeat.js@ 8d391a1

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

initial commit

  • Property mode set to 100644
File size: 1.7 KB
Line 
1/** PURE_IMPORTS_START tslib,_Subscriber,_observable_empty PURE_IMPORTS_END */
2import * as tslib_1 from "tslib";
3import { Subscriber } from '../Subscriber';
4import { empty } from '../observable/empty';
5export function repeat(count) {
6 if (count === void 0) {
7 count = -1;
8 }
9 return function (source) {
10 if (count === 0) {
11 return empty();
12 }
13 else if (count < 0) {
14 return source.lift(new RepeatOperator(-1, source));
15 }
16 else {
17 return source.lift(new RepeatOperator(count - 1, source));
18 }
19 };
20}
21var RepeatOperator = /*@__PURE__*/ (function () {
22 function RepeatOperator(count, source) {
23 this.count = count;
24 this.source = source;
25 }
26 RepeatOperator.prototype.call = function (subscriber, source) {
27 return source.subscribe(new RepeatSubscriber(subscriber, this.count, this.source));
28 };
29 return RepeatOperator;
30}());
31var RepeatSubscriber = /*@__PURE__*/ (function (_super) {
32 tslib_1.__extends(RepeatSubscriber, _super);
33 function RepeatSubscriber(destination, count, source) {
34 var _this = _super.call(this, destination) || this;
35 _this.count = count;
36 _this.source = source;
37 return _this;
38 }
39 RepeatSubscriber.prototype.complete = function () {
40 if (!this.isStopped) {
41 var _a = this, source = _a.source, count = _a.count;
42 if (count === 0) {
43 return _super.prototype.complete.call(this);
44 }
45 else if (count > -1) {
46 this.count = count - 1;
47 }
48 source.subscribe(this._unsubscribeAndRecycle());
49 }
50 };
51 return RepeatSubscriber;
52}(Subscriber));
53//# sourceMappingURL=repeat.js.map
Note: See TracBrowser for help on using the repository browser.