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 (b.hasOwnProperty(p)) d[p] = b[p]; };
7 return extendStatics(d, b);
9 return function (d, b) {
11 function __() { this.constructor = d; }
12 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15 Object.defineProperty(exports, "__esModule", { value: true });
16 var Subscriber_1 = require("../Subscriber");
17 var empty_1 = require("../observable/empty");
18 function repeat(count) {
19 if (count === void 0) { count = -1; }
20 return function (source) {
22 return empty_1.empty();
25 return source.lift(new RepeatOperator(-1, source));
28 return source.lift(new RepeatOperator(count - 1, source));
32 exports.repeat = repeat;
33 var RepeatOperator = (function () {
34 function RepeatOperator(count, source) {
38 RepeatOperator.prototype.call = function (subscriber, source) {
39 return source.subscribe(new RepeatSubscriber(subscriber, this.count, this.source));
41 return RepeatOperator;
43 var RepeatSubscriber = (function (_super) {
44 __extends(RepeatSubscriber, _super);
45 function RepeatSubscriber(destination, count, source) {
46 var _this = _super.call(this, destination) || this;
48 _this.source = source;
51 RepeatSubscriber.prototype.complete = function () {
52 if (!this.isStopped) {
53 var _a = this, source = _a.source, count = _a.count;
55 return _super.prototype.complete.call(this);
57 else if (count > -1) {
58 this.count = count - 1;
60 source.subscribe(this._unsubscribeAndRecycle());
63 return RepeatSubscriber;
64 }(Subscriber_1.Subscriber));
65 //# sourceMappingURL=repeat.js.map