kriszyp/dbind — pull request #7 by asudoh (2013-03-29 05:41:23+00:00)
Title: Support for repeat.

This change adds `dbind/forEach` module, as well as `dbind/store/Observable` module.

By importing `dbind/forEach` module (which returns the same object as `dbind/bind`), you can create repeating UI from array:

```javascript
require(['dbind/forEach'], function(bind){
var a = ['foo', 'bar'];
bind(anElement).forEach(a, {
createChild: function(entry){
var element = document.createElement("div");
element.innerText = entry;
return element;
}
});
});
```

If the array implements `observe(function(idx, removals, adds){ ... })` interface upon removals/adds of array elements (splice), the UI created in above way responds to such removals/adds.

`dbind/store/Observable` is based on `dojo/store/Observable`, which adds new third argument to `results.observe(listener, includeObjectUpdates, spliceStyle)`. The new third argument (`spliceStyle`) makes the interface of listener in `observe(function(idx, removals, adds){ ... })` format, instead of `observe(object, removedFrom, insertedInto){ ... })` format.