rarebreed / quartermaster

0 stars 0 forks source link

Write an Observable to capture all the /EntitlementStatus .entitlement_status_change signals #3

Open rarebreed opened 7 years ago

rarebreed commented 7 years ago

I was able to get the .check_status method from the /EntitlementStatus interface to work. What I need to do now figure out how to create an Observable of these signal events, and hook up an Observer to the Observable.

This is superior to either a Promise approach or a callback/event emitter approach. A Promise was designed to only wait for one asynchronous event. If multiple events are needed this is not what Promises were intended for. An Event Emitter approach would work, but it would have a couple of drawbacks:

1) Have to take care of cleanup (removeListener()) 2) Can't multicast to multiple observers easily 3) Would require nested callbacks