Opal-Estate-Pro/node_modules/rxjs/operators/debounceTime.js.map
2019-09-13 09:44:33 +07:00

1 line
6.3 KiB
Plaintext

{"version":3,"file":"debounceTime.js","sourceRoot":"","sources":["../../src/operators/debounceTime.ts"],"names":[],"mappings":";;;;;;AAEA,2BAA2B,eAAe,CAAC,CAAA;AAG3C,sBAAsB,oBAAoB,CAAC,CAAA;AAG3C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AACH,sBAAgC,OAAe,EAAE,SAA6B;IAA7B,yBAA6B,GAA7B,yBAA6B;IAC5E,MAAM,CAAC,UAAC,MAAqB,IAAK,OAAA,MAAM,CAAC,IAAI,CAAC,IAAI,oBAAoB,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC,EAAzD,CAAyD,CAAC;AAC9F,CAAC;AAFe,oBAAY,eAE3B,CAAA;AAED;IACE,8BAAoB,OAAe,EAAU,SAAqB;QAA9C,YAAO,GAAP,OAAO,CAAQ;QAAU,cAAS,GAAT,SAAS,CAAY;IAClE,CAAC;IAED,mCAAI,GAAJ,UAAK,UAAyB,EAAE,MAAW;QACzC,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,IAAI,sBAAsB,CAAC,UAAU,EAAE,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC;IAChG,CAAC;IACH,2BAAC;AAAD,CAAC,AAPD,IAOC;AAED;;;;GAIG;AACH;IAAwC,0CAAa;IAKnD,gCAAY,WAA0B,EAClB,OAAe,EACf,SAAqB;QACvC,kBAAM,WAAW,CAAC,CAAC;QAFD,YAAO,GAAP,OAAO,CAAQ;QACf,cAAS,GAAT,SAAS,CAAY;QANjC,0BAAqB,GAAiB,IAAI,CAAC;QAC3C,cAAS,GAAM,IAAI,CAAC;QACpB,aAAQ,GAAY,KAAK,CAAC;IAMlC,CAAC;IAES,sCAAK,GAAf,UAAgB,KAAQ;QACtB,IAAI,CAAC,aAAa,EAAE,CAAC;QACrB,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC;QACvB,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;QACrB,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,qBAAqB,GAAG,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,YAAY,EAAE,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC,CAAC;IACnG,CAAC;IAES,0CAAS,GAAnB;QACE,IAAI,CAAC,aAAa,EAAE,CAAC;QACrB,IAAI,CAAC,WAAW,CAAC,QAAQ,EAAE,CAAC;IAC9B,CAAC;IAED,8CAAa,GAAb;QACE,IAAI,CAAC,aAAa,EAAE,CAAC;QAErB,EAAE,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC;YAClB,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;YACtC,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;YACtB,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC;QACxB,CAAC;IACH,CAAC;IAEO,8CAAa,GAArB;QACE,IAAM,qBAAqB,GAAG,IAAI,CAAC,qBAAqB,CAAC;QAEzD,EAAE,CAAC,CAAC,qBAAqB,KAAK,IAAI,CAAC,CAAC,CAAC;YACnC,IAAI,CAAC,MAAM,CAAC,qBAAqB,CAAC,CAAC;YACnC,qBAAqB,CAAC,WAAW,EAAE,CAAC;YACpC,IAAI,CAAC,qBAAqB,GAAG,IAAI,CAAC;QACpC,CAAC;IACH,CAAC;IACH,6BAAC;AAAD,CAAC,AA1CD,CAAwC,uBAAU,GA0CjD;AAED,sBAAsB,UAAuC;IAC3D,UAAU,CAAC,aAAa,EAAE,CAAC;AAC7B,CAAC","sourcesContent":["import { Operator } from '../Operator';\nimport { Observable } from '../Observable';\nimport { Subscriber } from '../Subscriber';\nimport { IScheduler } from '../Scheduler';\nimport { Subscription, TeardownLogic } from '../Subscription';\nimport { async } from '../scheduler/async';\nimport { MonoTypeOperatorFunction } from '../interfaces';\n\n/**\n * Emits a value from the source Observable only after a particular time span\n * has passed without another source emission.\n *\n * <span class=\"informal\">It's like {@link delay}, but passes only the most\n * recent value from each burst of emissions.</span>\n *\n * <img src=\"./img/debounceTime.png\" width=\"100%\">\n *\n * `debounceTime` delays values emitted by the source Observable, but drops\n * previous pending delayed emissions if a new value arrives on the source\n * Observable. This operator keeps track of the most recent value from the\n * source Observable, and emits that only when `dueTime` enough time has passed\n * without any other value appearing on the source Observable. If a new value\n * appears before `dueTime` silence occurs, the previous value will be dropped\n * and will not be emitted on the output Observable.\n *\n * This is a rate-limiting operator, because it is impossible for more than one\n * value to be emitted in any time window of duration `dueTime`, but it is also\n * a delay-like operator since output emissions do not occur at the same time as\n * they did on the source Observable. Optionally takes a {@link IScheduler} for\n * managing timers.\n *\n * @example <caption>Emit the most recent click after a burst of clicks</caption>\n * var clicks = Rx.Observable.fromEvent(document, 'click');\n * var result = clicks.debounceTime(1000);\n * result.subscribe(x => console.log(x));\n *\n * @see {@link auditTime}\n * @see {@link debounce}\n * @see {@link delay}\n * @see {@link sampleTime}\n * @see {@link throttleTime}\n *\n * @param {number} dueTime The timeout duration in milliseconds (or the time\n * unit determined internally by the optional `scheduler`) for the window of\n * time required to wait for emission silence before emitting the most recent\n * source value.\n * @param {Scheduler} [scheduler=async] The {@link IScheduler} to use for\n * managing the timers that handle the timeout for each value.\n * @return {Observable} An Observable that delays the emissions of the source\n * Observable by the specified `dueTime`, and may drop some values if they occur\n * too frequently.\n * @method debounceTime\n * @owner Observable\n */\nexport function debounceTime<T>(dueTime: number, scheduler: IScheduler = async): MonoTypeOperatorFunction<T> {\n return (source: Observable<T>) => source.lift(new DebounceTimeOperator(dueTime, scheduler));\n}\n\nclass DebounceTimeOperator<T> implements Operator<T, T> {\n constructor(private dueTime: number, private scheduler: IScheduler) {\n }\n\n call(subscriber: Subscriber<T>, source: any): TeardownLogic {\n return source.subscribe(new DebounceTimeSubscriber(subscriber, this.dueTime, this.scheduler));\n }\n}\n\n/**\n * We need this JSDoc comment for affecting ESDoc.\n * @ignore\n * @extends {Ignored}\n */\nclass DebounceTimeSubscriber<T> extends Subscriber<T> {\n private debouncedSubscription: Subscription = null;\n private lastValue: T = null;\n private hasValue: boolean = false;\n\n constructor(destination: Subscriber<T>,\n private dueTime: number,\n private scheduler: IScheduler) {\n super(destination);\n }\n\n protected _next(value: T) {\n this.clearDebounce();\n this.lastValue = value;\n this.hasValue = true;\n this.add(this.debouncedSubscription = this.scheduler.schedule(dispatchNext, this.dueTime, this));\n }\n\n protected _complete() {\n this.debouncedNext();\n this.destination.complete();\n }\n\n debouncedNext(): void {\n this.clearDebounce();\n\n if (this.hasValue) {\n this.destination.next(this.lastValue);\n this.lastValue = null;\n this.hasValue = false;\n }\n }\n\n private clearDebounce(): void {\n const debouncedSubscription = this.debouncedSubscription;\n\n if (debouncedSubscription !== null) {\n this.remove(debouncedSubscription);\n debouncedSubscription.unsubscribe();\n this.debouncedSubscription = null;\n }\n }\n}\n\nfunction dispatchNext(subscriber: DebounceTimeSubscriber<any>) {\n subscriber.debouncedNext();\n}\n"]}