source: trip-planner-front/node_modules/rxjs/_esm5/internal/operators/timeoutWith.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: 2.8 KB
Line 
1/** PURE_IMPORTS_START tslib,_scheduler_async,_util_isDate,_innerSubscribe PURE_IMPORTS_END */
2import * as tslib_1 from "tslib";
3import { async } from '../scheduler/async';
4import { isDate } from '../util/isDate';
5import { SimpleOuterSubscriber, innerSubscribe, SimpleInnerSubscriber } from '../innerSubscribe';
6export function timeoutWith(due, withObservable, scheduler) {
7 if (scheduler === void 0) {
8 scheduler = async;
9 }
10 return function (source) {
11 var absoluteTimeout = isDate(due);
12 var waitFor = absoluteTimeout ? (+due - scheduler.now()) : Math.abs(due);
13 return source.lift(new TimeoutWithOperator(waitFor, absoluteTimeout, withObservable, scheduler));
14 };
15}
16var TimeoutWithOperator = /*@__PURE__*/ (function () {
17 function TimeoutWithOperator(waitFor, absoluteTimeout, withObservable, scheduler) {
18 this.waitFor = waitFor;
19 this.absoluteTimeout = absoluteTimeout;
20 this.withObservable = withObservable;
21 this.scheduler = scheduler;
22 }
23 TimeoutWithOperator.prototype.call = function (subscriber, source) {
24 return source.subscribe(new TimeoutWithSubscriber(subscriber, this.absoluteTimeout, this.waitFor, this.withObservable, this.scheduler));
25 };
26 return TimeoutWithOperator;
27}());
28var TimeoutWithSubscriber = /*@__PURE__*/ (function (_super) {
29 tslib_1.__extends(TimeoutWithSubscriber, _super);
30 function TimeoutWithSubscriber(destination, absoluteTimeout, waitFor, withObservable, scheduler) {
31 var _this = _super.call(this, destination) || this;
32 _this.absoluteTimeout = absoluteTimeout;
33 _this.waitFor = waitFor;
34 _this.withObservable = withObservable;
35 _this.scheduler = scheduler;
36 _this.scheduleTimeout();
37 return _this;
38 }
39 TimeoutWithSubscriber.dispatchTimeout = function (subscriber) {
40 var withObservable = subscriber.withObservable;
41 subscriber._unsubscribeAndRecycle();
42 subscriber.add(innerSubscribe(withObservable, new SimpleInnerSubscriber(subscriber)));
43 };
44 TimeoutWithSubscriber.prototype.scheduleTimeout = function () {
45 var action = this.action;
46 if (action) {
47 this.action = action.schedule(this, this.waitFor);
48 }
49 else {
50 this.add(this.action = this.scheduler.schedule(TimeoutWithSubscriber.dispatchTimeout, this.waitFor, this));
51 }
52 };
53 TimeoutWithSubscriber.prototype._next = function (value) {
54 if (!this.absoluteTimeout) {
55 this.scheduleTimeout();
56 }
57 _super.prototype._next.call(this, value);
58 };
59 TimeoutWithSubscriber.prototype._unsubscribe = function () {
60 this.action = undefined;
61 this.scheduler = null;
62 this.withObservable = null;
63 };
64 return TimeoutWithSubscriber;
65}(SimpleOuterSubscriber));
66//# sourceMappingURL=timeoutWith.js.map
Note: See TracBrowser for help on using the repository browser.