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

114
Vistas
Mutate Value Of Subscribe Object Without Convert It To Observable

I want to use these two solutions together with RxJS but I don't know how to do it.

pipe each data that Observable emits and have ability to act like a Subject:

// Sample code, this does not work properly :(, because next is not defined on Observable
const dummy = new Subject<number>().pipe(
  map((num) => num + 1)
);

dummy.subscribe((number) => {
  // expects 4 but get 3
})

dummy.next(3)

I want to emit data everywhere even outside of observable construction like Subscribe, and operate on each data emit using pipe method like Observable.

I can implement an simple emitter class that simulate this behavior but I want a RxJS way.

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

0

This is an abstraction that doesn't exist with RxJS.

You can build it yourself by defining kleisi composition for subjects. Basically do for subjects what pipe does for observables.

Subjects are observables and observers, so you can build the abstraction ontop of the operators that already exist by just tracking the source subject.


So why doesn't this already exist? Largly because it's not clear why it's even usefull. The operators operate on observables and not on observers.

Subjects are useful for multicasting (make a cold observable hot) and for interfacing/bridging between declarative and imperative code.

Historically attempts to integrate (instead of just interface) declarative and imperative api design has be frought with needless complexity.

The odd time that you need access to a subject and some steam of data together imperatively, it's probably clearer api to shove the two into an object or tuple and pass them atound that way. Extending the subject with a new type of composition just doesn't add much benefit, abstractly or concretely.

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