Last change
on this file was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
1.3 KB
|
Line | |
---|
1 | import { SimpleOuterSubscriber, SimpleInnerSubscriber, innerSubscribe } from '../innerSubscribe';
|
---|
2 | export function skipUntil(notifier) {
|
---|
3 | return (source) => source.lift(new SkipUntilOperator(notifier));
|
---|
4 | }
|
---|
5 | class SkipUntilOperator {
|
---|
6 | constructor(notifier) {
|
---|
7 | this.notifier = notifier;
|
---|
8 | }
|
---|
9 | call(destination, source) {
|
---|
10 | return source.subscribe(new SkipUntilSubscriber(destination, this.notifier));
|
---|
11 | }
|
---|
12 | }
|
---|
13 | class SkipUntilSubscriber extends SimpleOuterSubscriber {
|
---|
14 | constructor(destination, notifier) {
|
---|
15 | super(destination);
|
---|
16 | this.hasValue = false;
|
---|
17 | const innerSubscriber = new SimpleInnerSubscriber(this);
|
---|
18 | this.add(innerSubscriber);
|
---|
19 | this.innerSubscription = innerSubscriber;
|
---|
20 | const innerSubscription = innerSubscribe(notifier, innerSubscriber);
|
---|
21 | if (innerSubscription !== innerSubscriber) {
|
---|
22 | this.add(innerSubscription);
|
---|
23 | this.innerSubscription = innerSubscription;
|
---|
24 | }
|
---|
25 | }
|
---|
26 | _next(value) {
|
---|
27 | if (this.hasValue) {
|
---|
28 | super._next(value);
|
---|
29 | }
|
---|
30 | }
|
---|
31 | notifyNext() {
|
---|
32 | this.hasValue = true;
|
---|
33 | if (this.innerSubscription) {
|
---|
34 | this.innerSubscription.unsubscribe();
|
---|
35 | }
|
---|
36 | }
|
---|
37 | notifyComplete() {
|
---|
38 | }
|
---|
39 | }
|
---|
40 | //# sourceMappingURL=skipUntil.js.map |
---|
Note:
See
TracBrowser
for help on using the repository browser.