Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

291
Vistas
Using RXJS, is there a way to produce an observable that emits when the number of items, CURRENTLY emitted by the source Observables, is the same?

I have two observables (obs1 and obs2) that I want to pay attention to. They never complete and over their lifetime I can expect that they emit the same number of items. I cannot know which one will emit first. I need something that will emit every time the source observables have each emitted their nth item. So, I am looking for an observable that acts in either of these ways:

  • (a) It emits every time the source observables have each emitted the same number of items.
  • (b) It emits every time the source observable, that has currently emitted the least amount of items, makes an emission.

Example for a:

If obs1 emits its 1st item and then obs2 emits its 1st item, myObservable will produce its 1st emission. Then if obs2 emits a 2nd and 3rd item nothing will happen until obs1 emits its 2nd item and only then will myObservable produce its 2nd emission.

(a) When source observables have the same number of items emitted.

(b) Whenever, across all the source observables, the lowest number of items emitted increases.

about 4 years ago · Juan Pablo Isaza
2 Respuestas
Responde la pregunta

0

RxJS#zip

Zip does extactly what you're after.

For example, consider these two intervals that emit 5 times each but at different rates:

zip(
  interval(1000).pipe(map(v => v + 10) , take(5)), 
  interval(1500).pipe(map(v => v + 100), take(5))
).subscribe(console.log);
about 4 years ago · Juan Pablo Isaza Denunciar

0

I believe you want the "zip" function (or maybe combineLatest).

https://rxjs.dev/api/index/function/zip

https://rxjs.dev/api/index/function/combineLatest

https://www.freecodecamp.org/news/understand-rxjs-operators-by-eating-a-pizza/

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda