Server IP : 185.86.78.101 / Your IP : 216.73.216.124 Web Server : Apache System : Linux 675867-vds-valikoshka1996.gmhost.pp.ua 5.4.0-150-generic #167-Ubuntu SMP Mon May 15 17:35:05 UTC 2023 x86_64 User : www ( 1000) PHP Version : 7.4.33 Disable Function : passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /www/wwwroot/mifepriston.org/node_modules/rxjs/operators/ |
Upload File : |
"use strict"; var __extends = (this && this.__extends) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; var OuterSubscriber_1 = require('../OuterSubscriber'); var subscribeToResult_1 = require('../util/subscribeToResult'); /** * Emits a value from the source Observable only after a particular time span * determined by another Observable has passed without another source emission. * * <span class="informal">It's like {@link debounceTime}, but the time span of * emission silence is determined by a second Observable.</span> * * <img src="./img/debounce.png" width="100%"> * * `debounce` delays values emitted by the source Observable, but drops previous * pending delayed emissions if a new value arrives on the source Observable. * This operator keeps track of the most recent value from the source * Observable, and spawns a duration Observable by calling the * `durationSelector` function. The value is emitted only when the duration * Observable emits a value or completes, and if no other value was emitted on * the source Observable since the duration Observable was spawned. If a new * value appears before the duration Observable emits, the previous value will * be dropped and will not be emitted on the output Observable. * * Like {@link debounceTime}, this is a rate-limiting operator, and also a * delay-like operator since output emissions do not necessarily occur at the * same time as they did on the source Observable. * * @example <caption>Emit the most recent click after a burst of clicks</caption> * var clicks = Rx.Observable.fromEvent(document, 'click'); * var result = clicks.debounce(() => Rx.Observable.interval(1000)); * result.subscribe(x => console.log(x)); * * @see {@link audit} * @see {@link debounceTime} * @see {@link delayWhen} * @see {@link throttle} * * @param {function(value: T): SubscribableOrPromise} durationSelector A function * that receives a value from the source Observable, for computing the timeout * duration for each source value, returned as an Observable or a Promise. * @return {Observable} An Observable that delays the emissions of the source * Observable by the specified duration Observable returned by * `durationSelector`, and may drop some values if they occur too frequently. * @method debounce * @owner Observable */ 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; }()); /** * We need this JSDoc comment for affecting ESDoc. * @ignore * @extends {Ignored} */ var DebounceSubscriber = (function (_super) { __extends(DebounceSubscriber, _super); function DebounceSubscriber(destination, durationSelector) { _super.call(this, destination); this.durationSelector = durationSelector; this.hasValue = false; this.durationSubscription = null; } 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 = subscribeToResult_1.subscribeToResult(this, duration); if (!subscription.closed) { this.add(this.durationSubscription = subscription); } }; DebounceSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex, innerSub) { 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 = null; subscription.unsubscribe(); this.remove(subscription); } this.value = null; this.hasValue = false; _super.prototype._next.call(this, value); } }; return DebounceSubscriber; }(OuterSubscriber_1.OuterSubscriber)); //# sourceMappingURL=debounce.js.map