diff options
author | Danijel Andjelkovic <adanijel99@gmail.com> | 2022-03-01 20:21:29 +0000 |
---|---|---|
committer | Danijel Andjelkovic <adanijel99@gmail.com> | 2022-03-01 20:21:29 +0000 |
commit | 61cb1570a3410c85a4489b97c172e3a50715f36c (patch) | |
tree | 8fe4a5b77ea54bba80abc817ce2c9ef0e79e7e66 /sandbox/testAppNevena/Front/node_modules/rxjs/internal/operators/debounce.js | |
parent | 21a53d349788c99d2007cba91a923db982353b31 (diff) | |
parent | a9ee9e0a500a4a15bd0b5dcaf041f827228ed309 (diff) |
Merge branch 'researchML' into 'dev'
Research ml
See merge request igrannonica/neuronstellar!6
Diffstat (limited to 'sandbox/testAppNevena/Front/node_modules/rxjs/internal/operators/debounce.js')
-rw-r--r-- | sandbox/testAppNevena/Front/node_modules/rxjs/internal/operators/debounce.js | 88 |
1 files changed, 88 insertions, 0 deletions
diff --git a/sandbox/testAppNevena/Front/node_modules/rxjs/internal/operators/debounce.js b/sandbox/testAppNevena/Front/node_modules/rxjs/internal/operators/debounce.js new file mode 100644 index 00000000..84164cf0 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/rxjs/internal/operators/debounce.js @@ -0,0 +1,88 @@ +"use strict"; +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return extendStatics(d, b); + } + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); +var innerSubscribe_1 = require("../innerSubscribe"); +function debounce(durationSelector) { + return function (source) { return source.lift(new DebounceOperator(durationSelector)); }; +} +exports.debounce = debounce; +var DebounceOperator = (function () { + function DebounceOperator(durationSelector) { + this.durationSelector = durationSelector; + } + DebounceOperator.prototype.call = function (subscriber, source) { + return source.subscribe(new DebounceSubscriber(subscriber, this.durationSelector)); + }; + return DebounceOperator; +}()); +var DebounceSubscriber = (function (_super) { + __extends(DebounceSubscriber, _super); + function DebounceSubscriber(destination, durationSelector) { + var _this = _super.call(this, destination) || this; + _this.durationSelector = durationSelector; + _this.hasValue = false; + return _this; + } + DebounceSubscriber.prototype._next = function (value) { + try { + var result = this.durationSelector.call(this, value); + if (result) { + this._tryNext(value, result); + } + } + catch (err) { + this.destination.error(err); + } + }; + DebounceSubscriber.prototype._complete = function () { + this.emitValue(); + this.destination.complete(); + }; + DebounceSubscriber.prototype._tryNext = function (value, duration) { + var subscription = this.durationSubscription; + this.value = value; + this.hasValue = true; + if (subscription) { + subscription.unsubscribe(); + this.remove(subscription); + } + subscription = innerSubscribe_1.innerSubscribe(duration, new innerSubscribe_1.SimpleInnerSubscriber(this)); + if (subscription && !subscription.closed) { + this.add(this.durationSubscription = subscription); + } + }; + DebounceSubscriber.prototype.notifyNext = function () { + this.emitValue(); + }; + DebounceSubscriber.prototype.notifyComplete = function () { + this.emitValue(); + }; + DebounceSubscriber.prototype.emitValue = function () { + if (this.hasValue) { + var value = this.value; + var subscription = this.durationSubscription; + if (subscription) { + this.durationSubscription = undefined; + subscription.unsubscribe(); + this.remove(subscription); + } + this.value = undefined; + this.hasValue = false; + _super.prototype._next.call(this, value); + } + }; + return DebounceSubscriber; +}(innerSubscribe_1.SimpleOuterSubscriber)); +//# sourceMappingURL=debounce.js.map
\ No newline at end of file |