Actualizacion maquina principal
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-prettier / node_modules / rxjs / _esm2015 / internal / operators / sample.js
1 import { OuterSubscriber } from '../OuterSubscriber';
2 import { subscribeToResult } from '../util/subscribeToResult';
3 export function sample(notifier) {
4     return (source) => source.lift(new SampleOperator(notifier));
5 }
6 class SampleOperator {
7     constructor(notifier) {
8         this.notifier = notifier;
9     }
10     call(subscriber, source) {
11         const sampleSubscriber = new SampleSubscriber(subscriber);
12         const subscription = source.subscribe(sampleSubscriber);
13         subscription.add(subscribeToResult(sampleSubscriber, this.notifier));
14         return subscription;
15     }
16 }
17 class SampleSubscriber extends OuterSubscriber {
18     constructor() {
19         super(...arguments);
20         this.hasValue = false;
21     }
22     _next(value) {
23         this.value = value;
24         this.hasValue = true;
25     }
26     notifyNext(outerValue, innerValue, outerIndex, innerIndex, innerSub) {
27         this.emitValue();
28     }
29     notifyComplete() {
30         this.emitValue();
31     }
32     emitValue() {
33         if (this.hasValue) {
34             this.hasValue = false;
35             this.destination.next(this.value);
36         }
37     }
38 }
39 //# sourceMappingURL=sample.js.map