Difference between revisions of "Observable versus promise"

From Wiki @ Karl Jones dot com
Jump to: navigation, search
(Created page with "This article contrasts observables (see Observer pattern) with promises (see Futures and promises). == Run conditions == * Observables are lazy -- they do not run un...")
 
(See also)
 
Line 21: Line 21:
 
== See also ==
 
== See also ==
  
* [[Future and promises]]
+
* [[Futures and promises]]
 
* [[Observer pattern]]
 
* [[Observer pattern]]
 
* [[Promise object (JavaScript)]]
 
* [[Promise object (JavaScript)]]
  
 
[[Category:Computer programming]]
 
[[Category:Computer programming]]

Latest revision as of 15:29, 2 January 2017

This article contrasts observables (see Observer pattern) with promises (see Futures and promises).

Run conditions

  • Observables are lazy -- they do not run unless subscribed to
  • Promises run no matter what

Setup and teardown

  • Observables can define both setup and teardown aspects of asynchronous behavior.

Cancellable

  • Observables are cancellable.

Retriability

  • Observables can be retried
  • To retry promises, a caller must have access to the original function that returned the promise.

See also