X-Git-Url: https://git.josue.xyz/?p=dotfiles%2F.git;a=blobdiff_plain;f=.config%2Fcoc%2Fextensions%2Fnode_modules%2Fcoc-prettier%2Fnode_modules%2Frxjs%2Fsrc%2Finternal%2Foperators%2Fthrottle.ts;h=380e72e63b5bf571afb3d2e8ca4eb77352224216;hp=e855ff0a8a40336b0c83d98a32397dc42eb3593b;hb=4d07c77cf4d78cab8639e13ddc3c22495e585b0b;hpb=b3950616b54221c40a7dab9099bda675007e5b6e diff --git a/.config/coc/extensions/node_modules/coc-prettier/node_modules/rxjs/src/internal/operators/throttle.ts b/.config/coc/extensions/node_modules/coc-prettier/node_modules/rxjs/src/internal/operators/throttle.ts index e855ff0a..380e72e6 100644 --- a/.config/coc/extensions/node_modules/coc-prettier/node_modules/rxjs/src/internal/operators/throttle.ts +++ b/.config/coc/extensions/node_modules/coc-prettier/node_modules/rxjs/src/internal/operators/throttle.ts @@ -3,11 +3,8 @@ import { Observable } from '../Observable'; import { Subscriber } from '../Subscriber'; import { Subscription } from '../Subscription'; -import { OuterSubscriber } from '../OuterSubscriber'; -import { InnerSubscriber } from '../InnerSubscriber'; -import { subscribeToResult } from '../util/subscribeToResult'; - import { MonoTypeOperatorFunction, SubscribableOrPromise, TeardownLogic } from '../types'; +import { SimpleOuterSubscriber, innerSubscribe, SimpleInnerSubscriber } from '../innerSubscribe'; export interface ThrottleConfig { leading?: boolean; @@ -67,7 +64,7 @@ export const defaultThrottleConfig: ThrottleConfig = { */ export function throttle(durationSelector: (value: T) => SubscribableOrPromise, config: ThrottleConfig = defaultThrottleConfig): MonoTypeOperatorFunction { - return (source: Observable) => source.lift(new ThrottleOperator(durationSelector, config.leading, config.trailing)); + return (source: Observable) => source.lift(new ThrottleOperator(durationSelector, !!config.leading, !!config.trailing)); } class ThrottleOperator implements Operator { @@ -88,9 +85,9 @@ class ThrottleOperator implements Operator { * @ignore * @extends {Ignored} */ -class ThrottleSubscriber extends OuterSubscriber { - private _throttled: Subscription; - private _sendValue: T; +class ThrottleSubscriber extends SimpleOuterSubscriber { + private _throttled?: Subscription; + private _sendValue?: T; private _hasValue = false; constructor(protected destination: Subscriber, @@ -117,20 +114,20 @@ class ThrottleSubscriber extends OuterSubscriber { const { _hasValue, _sendValue } = this; if (_hasValue) { this.destination.next(_sendValue); - this.throttle(_sendValue); + this.throttle(_sendValue!); } this._hasValue = false; - this._sendValue = null; + this._sendValue = undefined; } private throttle(value: T): void { const duration = this.tryDurationSelector(value); if (!!duration) { - this.add(this._throttled = subscribeToResult(this, duration)); + this.add(this._throttled = innerSubscribe(duration, new SimpleInnerSubscriber(this))); } } - private tryDurationSelector(value: T): SubscribableOrPromise { + private tryDurationSelector(value: T): SubscribableOrPromise | null { try { return this.durationSelector(value); } catch (err) { @@ -144,16 +141,14 @@ class ThrottleSubscriber extends OuterSubscriber { if (_throttled) { _throttled.unsubscribe(); } - this._throttled = null; + this._throttled = undefined; if (_trailing) { this.send(); } } - notifyNext(outerValue: T, innerValue: R, - outerIndex: number, innerIndex: number, - innerSub: InnerSubscriber): void { + notifyNext(): void { this.throttlingDone(); }