The library exposes a single way of initializing an observable collection, which is great for most cases. On the other hand, there are situations where view models may need to expose a read-only observable collection and have specific methods for add, updating and removing items.
The library should expose two classes, ReadOnlyObservableCollection
and ObservableCollection
where the former exposes protected array mutating methods (push, splice, shift, unshift etc.) and the latter extends the former and exposes these methods.
In addition, the observable collection exposes an event that notifies observers when an item was added and allows a clean-up callback to be returned specific to that item, the callback is called when the respective item is removed. This will allow for safe event subscription/unsubscription for each item as it is add and removed from the collection through closures.