dimanche 18 février 2018

In need of Angular pre-observable

I am currently using rxjs/Subject Observable object in several locations in my app. I like the way that it works because you can just add more subscribers to the service any time you want and you don't have to modify any other component that sends messages, however i have a new use case that i don't think this object can handle and I am wondering if there is another object that does what i need.

The scenario is this:

I have one component that needs to import the object and send a message in the same way that rxjs/Subject does it, I have another component that needs to subscribe to messages and in most cases it will respond to them in real time, however on app load this component is loaded after the first one and so therefore misses the first message (which is sent immediately when the first component is loaded)

Is there such a design pattern where messages can be queued up and read by observers at a later point?

I'm sure i could make this myself, but i'd rather not re-invent the wheel if i don't have to.

Aucun commentaire:

Enregistrer un commentaire