1 /** PURE_IMPORTS_START tslib,_Subscriber,_observable_empty PURE_IMPORTS_END */
2 import * as tslib_1 from "tslib";
3 import { Subscriber } from '../Subscriber';
4 import { empty } from '../observable/empty';
5 export function repeat(count) {
6 if (count === void 0) {
9 return function (source) {
14 return source.lift(new RepeatOperator(-1, source));
17 return source.lift(new RepeatOperator(count - 1, source));
21 var RepeatOperator = /*@__PURE__*/ (function () {
22 function RepeatOperator(count, source) {
26 RepeatOperator.prototype.call = function (subscriber, source) {
27 return source.subscribe(new RepeatSubscriber(subscriber, this.count, this.source));
29 return RepeatOperator;
31 var RepeatSubscriber = /*@__PURE__*/ (function (_super) {
32 tslib_1.__extends(RepeatSubscriber, _super);
33 function RepeatSubscriber(destination, count, source) {
34 var _this = _super.call(this, destination) || this;
36 _this.source = source;
39 RepeatSubscriber.prototype.complete = function () {
40 if (!this.isStopped) {
41 var _a = this, source = _a.source, count = _a.count;
43 return _super.prototype.complete.call(this);
45 else if (count > -1) {
46 this.count = count - 1;
48 source.subscribe(this._unsubscribeAndRecycle());
51 return RepeatSubscriber;
53 //# sourceMappingURL=repeat.js.map