Rx.Observable.prototype.scan([seed], accumulator)

</rx-marbles>

Applies an accumulator function over an observable sequence and returns each intermediate result. The optional seed value is used as the initial accumulator value.

For aggregation behavior with no intermediate results, see Rx.Observable.aggregate.

Arguments

  1. [seed] (Any): The initial accumulator value.
  2. accumulator (Function): An accumulator function to be invoked on each element.

Returns

(Observable): An observable sequence which results from the comonadic bind operation.

Example

Without a seed

With a seed