addArrayObserver (target, opts) Ember.Array
public
Adds an array observer to the receiving array. The array observer object normally must implement two methods:
-
arrayWillChange(observedObj, start, removeCount, addCount)
- This method will be called just before the array is modified. -
arrayDidChange(observedObj, start, removeCount, addCount)
- This method will be called just after the array is modified.
Both callbacks will be passed the observed object, starting index of the change as well as a count of the items to be removed and added. You can use these callbacks to optionally inspect the array during the change, clear caches, or do any other bookkeeping necessary.
In addition to passing a target, you can also include an options hash which you can use to override the method names that will be invoked on the target.
Parameters:
-
target
Object
- The observer object.
-
opts
Object
- Optional hash of configuration options including `willChange` and `didChange` option.
Returns:
-
Ember.Array
- receiver
Please login to continue.