I\'d like to add some \"ArrayCollection\" like functionality to a ko.observableArray();
i.e removeItemAt(index)//dispatches item removed event addItem(item)//dispatches
Extending observableArrays
is easy and a perfectly reasonable thing to do.
The easiest way to accomplish this is to add functions to ko.observableArray.fn
. There is now a documentation page for this technique.
This is a little bit different than what you are after, but here is a nice implementation of a dictionary in ko that may be of interest to you: https://github.com/jamesfoster/knockout.observableDictionary