biofriction-wp-theme/node_modules/rxjs/operators/sample.js.map

1 line
4.4 KiB
Plaintext

{"version":3,"file":"sample.js","sourceRoot":"","sources":["../../src/operators/sample.ts"],"names":[],"mappings":";;;;;;AAIA,gCAAgC,oBAAoB,CAAC,CAAA;AAErD,kCAAkC,2BAA2B,CAAC,CAAA;AAI9D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,gBAA0B,QAAyB;IACjD,MAAM,CAAC,UAAC,MAAqB,IAAK,OAAA,MAAM,CAAC,IAAI,CAAC,IAAI,cAAc,CAAC,QAAQ,CAAC,CAAC,EAAzC,CAAyC,CAAC;AAC9E,CAAC;AAFe,cAAM,SAErB,CAAA;AAED;IACE,wBAAoB,QAAyB;QAAzB,aAAQ,GAAR,QAAQ,CAAiB;IAC7C,CAAC;IAED,6BAAI,GAAJ,UAAK,UAAyB,EAAE,MAAW;QACzC,IAAM,gBAAgB,GAAG,IAAI,gBAAgB,CAAC,UAAU,CAAC,CAAC;QAC1D,IAAM,YAAY,GAAG,MAAM,CAAC,SAAS,CAAC,gBAAgB,CAAC,CAAC;QACxD,YAAY,CAAC,GAAG,CAAC,qCAAiB,CAAC,gBAAgB,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC;QACrE,MAAM,CAAC,YAAY,CAAC;IACtB,CAAC;IACH,qBAAC;AAAD,CAAC,AAVD,IAUC;AAED;;;;GAIG;AACH;IAAqC,oCAAqB;IAA1D;QAAqC,8BAAqB;QAEhD,aAAQ,GAAY,KAAK,CAAC;IAuBpC,CAAC;IArBW,gCAAK,GAAf,UAAgB,KAAQ;QACtB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;IACvB,CAAC;IAED,qCAAU,GAAV,UAAW,UAAa,EAAE,UAAa,EAC5B,UAAkB,EAAE,UAAkB,EACtC,QAA+B;QACxC,IAAI,CAAC,SAAS,EAAE,CAAC;IACnB,CAAC;IAED,yCAAc,GAAd;QACE,IAAI,CAAC,SAAS,EAAE,CAAC;IACnB,CAAC;IAED,oCAAS,GAAT;QACE,EAAE,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC;YAClB,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC;YACtB,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACpC,CAAC;IACH,CAAC;IACH,uBAAC;AAAD,CAAC,AAzBD,CAAqC,iCAAe,GAyBnD","sourcesContent":["import { Operator } from '../Operator';\nimport { Observable } from '../Observable';\nimport { Subscriber } from '../Subscriber';\nimport { TeardownLogic } from '../Subscription';\nimport { OuterSubscriber } from '../OuterSubscriber';\nimport { InnerSubscriber } from '../InnerSubscriber';\nimport { subscribeToResult } from '../util/subscribeToResult';\n\nimport { MonoTypeOperatorFunction } from '../interfaces';\n\n/**\n * Emits the most recently emitted value from the source Observable whenever\n * another Observable, the `notifier`, emits.\n *\n * <span class=\"informal\">It's like {@link sampleTime}, but samples whenever\n * the `notifier` Observable emits something.</span>\n *\n * <img src=\"./img/sample.png\" width=\"100%\">\n *\n * Whenever the `notifier` Observable emits a value or completes, `sample`\n * looks at the source Observable and emits whichever value it has most recently\n * emitted since the previous sampling, unless the source has not emitted\n * anything since the previous sampling. The `notifier` is subscribed to as soon\n * as the output Observable is subscribed.\n *\n * @example <caption>On every click, sample the most recent \"seconds\" timer</caption>\n * var seconds = Rx.Observable.interval(1000);\n * var clicks = Rx.Observable.fromEvent(document, 'click');\n * var result = seconds.sample(clicks);\n * result.subscribe(x => console.log(x));\n *\n * @see {@link audit}\n * @see {@link debounce}\n * @see {@link sampleTime}\n * @see {@link throttle}\n *\n * @param {Observable<any>} notifier The Observable to use for sampling the\n * source Observable.\n * @return {Observable<T>} An Observable that emits the results of sampling the\n * values emitted by the source Observable whenever the notifier Observable\n * emits value or completes.\n * @method sample\n * @owner Observable\n */\nexport function sample<T>(notifier: Observable<any>): MonoTypeOperatorFunction<T> {\n return (source: Observable<T>) => source.lift(new SampleOperator(notifier));\n}\n\nclass SampleOperator<T> implements Operator<T, T> {\n constructor(private notifier: Observable<any>) {\n }\n\n call(subscriber: Subscriber<T>, source: any): TeardownLogic {\n const sampleSubscriber = new SampleSubscriber(subscriber);\n const subscription = source.subscribe(sampleSubscriber);\n subscription.add(subscribeToResult(sampleSubscriber, this.notifier));\n return subscription;\n }\n}\n\n/**\n * We need this JSDoc comment for affecting ESDoc.\n * @ignore\n * @extends {Ignored}\n */\nclass SampleSubscriber<T, R> extends OuterSubscriber<T, R> {\n private value: T;\n private hasValue: boolean = false;\n\n protected _next(value: T) {\n this.value = value;\n this.hasValue = true;\n }\n\n notifyNext(outerValue: T, innerValue: R,\n outerIndex: number, innerIndex: number,\n innerSub: InnerSubscriber<T, R>): void {\n this.emitValue();\n }\n\n notifyComplete(): void {\n this.emitValue();\n }\n\n emitValue() {\n if (this.hasValue) {\n this.hasValue = false;\n this.destination.next(this.value);\n }\n }\n}\n"]}