Closed james-shaw-turner closed 9 years ago
In CJS we don't listen to specific items within a node-list, and instead listen to the entire node-list, so there is no need to add and remove listeners as items are added and removed from a node-list.
For example:
model.legs.on('change', function(legs) {
// do stuff...
});
@dchambers
Just to be clear you are saying that the object returned by model.legs.item(0)
has set()
and get()
methods but no on()
method.
It's not currently documented (unless I'm missing it) so I assume you can listen to all properties in the nodelist as follows:
model.legs.p("foo").on("change", function(pValues, pOldValues){
...
});
However we still need structure change events on the nodelist (legs in this case) - so we can update any GUI appropriately.
I've spoken to @james-shaw-turner and he's happy for this to be closed.
@dchambers
If a code external to the model retrieves an item in a nodelist. It needs to remove the listener if the nodelist item is removed. NodeLists need to support structure changed event listeners.