Class Ember.Array
This module implements Observer-friendly Array-like behavior. This mixin is picked up by the Array class as well as other controllers, etc. that want to appear to be arrays.
Unlike Ember.Enumerable,
this mixin defines methods specifically for
collections that provide index-ordered access to their contents. When you
are designing code that needs to accept any kind of Array-like object, you
should use these methods instead of Array primitives because these will
properly notify observers of changes to the array.
Although these methods are efficient, they do add a layer of indirection to your application so it is a good idea to use them only when you need the flexibility of using both true JavaScript arrays and "virtual" arrays such as controllers and collections.
You can use the methods defined in this module to access and modify array
contents in a KVO-friendly way. You can also be notified whenever the
membership of an array changes by changing the syntax of the property to
.observes('*myProperty.[]')
.
To support Ember.Array
in your own class, you must override two
primitives to use it: replace()
and objectAt()
.
Note that the Ember.Array mixin also incorporates the Ember.Enumerable
mixin. All Ember.Array
-like objects are also enumerable.
Methods
- addArrayObserver
- addEnumerableObserver
- any
- anyBy
- arrayContentDidChange
- arrayContentWillChange
- compact
- contains
- enumerableContentDidChange
- enumerableContentWillChange
- every
- everyBy
- filter
- filterBy
- find
- findBy
- forEach
- getEach
- indexOf
- invoke
- lastIndexOf
- map
- mapBy
- nextObject
- objectAt
- objectsAt
- reduce
- reject
- rejectBy
- removeArrayObserver
- removeEnumerableObserver
- setEach
- slice
- toArray
- uniq
- without
Properties
Events
No documented items