Questions tagged [takeuntil]

10 questions
5
votes
3 answers

RxJs - How to return notifier value with takeuntil operator

I have a simple Rxjs timer that keeps going until a notifier emits something, very basic till here. enum TimerResult = { COMPLETE, ABORTED, SKIPPED }; _notifier: Subject = new Subject(); notifier$: Observable =…
4
votes
2 answers

how to take an action after takeUntil rxjs function

So I am trying to have a boolean be true if the function running runs long enough to trigger the takenUntil function which is running on a timer. Here is the code start =…
2
votes
0 answers

RxJS timer restart

I need to create an inactivity modal in my Angular project using timer from RxJS. Since I'm new with RxJS, I'm having a troubles with it. Here is the code I have right now. It works but the issue that I have is to restart the timer after the user…
Jose R. Chacón
  • 99
  • 1
  • 12
1
vote
1 answer

where would you put takeUntil RXJS in this code that polls a server?

So the code below has been developed off the answer I got in this stack overflow question. the code is designed to poll my server until either a condition on the server is true, or polling has occurred for a minute. I understand I can stop the…
1
vote
1 answer

How to correctly use withIndex with takeUntil ,forEachWhile, with RxJava?

In my expression, even takeUntil is true/false, subscribe method is emitting all the list items, which should stop once takeUntil is true right? Observable.fromIterable(countryResponseList.withIndex()) .subscribeOn(Schedulers.io()) …
Manoj Perumarath
  • 9,337
  • 8
  • 56
  • 77
0
votes
1 answer

RxJS - Observable does not execute when takeUntil and its notifier observable emits in the same internal observable

Code: const main$ = of(true); const int$ = interval(2000); const notifier$ = new Subject(); main$.pipe( switchMap(() => int$.pipe( tap(() => { // some logic for when to trigger notifier …
0
votes
2 answers

Unsubscribe fromEvent RxJs using Subject

can I unsubscribe fromtEvent RxJs using takeUntil with Subject inside? My example code is like this: private _closed$: Subject = new Subject(); fromEvent(document, 'mousedown') .pipe(takeUntil(this._closed$)); But the problem…
0
votes
1 answer

RxJS - An observable 'A' doesn't stop emitting with a takeUntil that is piped from the same observable 'A'

I have an observable that prints a number to the console every second after a start button is clicked. The observable should stop printing 5 seconds after the start button is clicked. Start Condition every second after the start button is…
uMar ..
  • 1
  • 1
0
votes
1 answer

Repeat query until condition is met

I do an HTTP request to an API that returns 350 records. Each item have a property called "total". I need to select 5 items randomly but also, the sum of the property "total" of those 5 items should be less than 30. I think this can be done using…
Jose R. Chacón
  • 99
  • 1
  • 12
0
votes
1 answer

.pipe(takeUntil) is listening when it is not supposed to

We are using .pipe(takeUntil) in the logincomponent.ts. What I need is, it should get destroyed after successful log in and the user is on the landing page. However, the below snippet is being called even when the user is trying to do other activity…
Avi
  • 65
  • 1
  • 8