Observable versus promise

From Wiki @ Karl Jones dot com
Jump to: navigation, search

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