baconjs/bacon.js — pull request #337 by raimohanska (2014-02-24 13:52:03+00:00)
Title: Feature/defer dispatch

Defer dispatching events to all external subscribers, until the current event transaction is done with.

External subscribers are the users of `subscribe`, `onValue` and friends. Internal subscribers are Observables created by applying a combinator.

In the example below, `b` is an internal subscriber of `a` while `print` is an external subscriber of `b`.

```coffeescript
a = Bacon.once("a")
b = a.map((x) -> x + x)
print = (x) -> console.log("got", x)
b.onValue(print)
```

This change is bound to make application code more reliable, as now it doesn't matter if you create your Observables in a `onValue` callback. With 0.7.4 and below, there are some behavioral differences caused by the fact that `onValue` subscribers may be called before the current event transaction if fully dealt with.