Breeze / breeze-client

Breeze for JavaScript clients
MIT License
38 stars 16 forks source link

use rxjs observable for the new breeze client #2

Closed badre429 closed 6 years ago

badre429 commented 6 years ago

use rxjs observable for the new breeze client to handle async event

marcelgood commented 6 years ago

We may consider adding an optional observable layer, but breeze itself will most likely continue to use promises under the hood. There are a couple of reasons for that. We don't want to add a dependency to rxjs for everybody and operations like executeQuery and saveChanges are all one-and-done operations. Other than cancellation ability there isn't much to gain with observables and operations like saveChanges can't be cancelled w/o risking data integrity issues anyway.

Turning a promise into an observable is straight forward if you need it at the higher level of your app. In many cases promises and observables can be interchanged. Most of the applications we develop with breeze use observables and promises side-by-side and going from one to the other is a non-issue.