montagejs/montage — pull request #1029 by kriskowal (2012-11-13 04:12:09+00:00)
Title: Add path change listeners

This is an idea for supporting path change listeners. It has several forms, laid out in the added spec.

The first form is for mapped collection. In this case, there is no need for a handler; it just returns the mapped collection. This works because observers that produce incrementally updated collections guarantee that they will only emit their output value once.

The advantage of this form is that, with the mapped collection, you can call one of the orthogonal shallow change listeners on that collection, `addOwnPropertyChangeListener`, `addMapChangeListener`, or `addRangeChangeListener`.

The following forms are for handlers that get called each time a terminal value changes. The first form is a plain function, and we test both before change and after change cases.

The second kind of handler is an object that implements `handlePathChange`.

The last form calls a delegated method, distinguished by token, in this case `handleFooSumChange` for the token `fooSum`.