Software: Apache/2.4.41 (Ubuntu). PHP/8.0.30 uname -a: Linux apirnd 5.4.0-204-generic #224-Ubuntu SMP Thu Dec 5 13:38:28 UTC 2024 x86_64 uid=33(www-data) gid=33(www-data) groups=33(www-data) Safe-mode: OFF (not secure) /usr/local/lib/node_modules/strapi/node_modules/rxjs/_esm2015/internal/operators/ drwxr-xr-x | |
| Viewing file: Select action/file-type: import { SimpleOuterSubscriber, innerSubscribe, SimpleInnerSubscriber } from '../innerSubscribe';
export const defaultThrottleConfig = {
leading: true,
trailing: false
};
export function throttle(durationSelector, config = defaultThrottleConfig) {
return (source) => source.lift(new ThrottleOperator(durationSelector, !!config.leading, !!config.trailing));
}
class ThrottleOperator {
constructor(durationSelector, leading, trailing) {
this.durationSelector = durationSelector;
this.leading = leading;
this.trailing = trailing;
}
call(subscriber, source) {
return source.subscribe(new ThrottleSubscriber(subscriber, this.durationSelector, this.leading, this.trailing));
}
}
class ThrottleSubscriber extends SimpleOuterSubscriber {
constructor(destination, durationSelector, _leading, _trailing) {
super(destination);
this.destination = destination;
this.durationSelector = durationSelector;
this._leading = _leading;
this._trailing = _trailing;
this._hasValue = false;
}
_next(value) {
this._hasValue = true;
this._sendValue = value;
if (!this._throttled) {
if (this._leading) {
this.send();
}
else {
this.throttle(value);
}
}
}
send() {
const { _hasValue, _sendValue } = this;
if (_hasValue) {
this.destination.next(_sendValue);
this.throttle(_sendValue);
}
this._hasValue = false;
this._sendValue = undefined;
}
throttle(value) {
const duration = this.tryDurationSelector(value);
if (!!duration) {
this.add(this._throttled = innerSubscribe(duration, new SimpleInnerSubscriber(this)));
}
}
tryDurationSelector(value) {
try {
return this.durationSelector(value);
}
catch (err) {
this.destination.error(err);
return null;
}
}
throttlingDone() {
const { _throttled, _trailing } = this;
if (_throttled) {
_throttled.unsubscribe();
}
this._throttled = undefined;
if (_trailing) {
this.send();
}
}
notifyNext() {
this.throttlingDone();
}
notifyComplete() {
this.throttlingDone();
}
}
//# sourceMappingURL=throttle.js.map |
:: Command execute :: | |
--[ c99shell v. 2.5 [PHP 8 Update] [24.05.2025] | Generation time: 0.0171 ]-- |