Class Ember.NativeArray

The NativeArray mixin contains the properties needed to to make the native Array support Ember.MutableArray and all of its dependent APIs. Unless you have Ember.EXTEND_PROTOTYPES or Ember.EXTEND_PROTOTYPES.Array set to false, this will be applied automatically. Otherwise you can apply the mixin at anytime by calling Ember.NativeArray.activate.

Show:

Module: ember

Returns a special object that can be used to observe individual properties on the array. Just get an equivalent property on this object and it will return an enumerable that maps automatically to the named key on the member objects.

If you merely want to watch for any items being added or removed to the array, use the [] property instead of @each.

Module: ember

Becomes true whenever the array currently has observers watching changes on the array.

Module: ember
returns
this

This property will trigger anytime the enumerable's content changes. You can observe this property to be notified of changes to the enumerables content.

For plain enumerables, this property is read only. Ember.Array overrides this method.

Module: ember
returns
this

This property will trigger anytime the enumerable's content changes. You can observe this property to be notified of changes to the enumerables content.

For plain enumerables, this property is read only. Ember.Array overrides this method.

Module: ember
returns
Object
the object or undefined

Helper method returns the first object from a collection. This is usually used by bindings and other parts of the framework to extract a single object if the enumerable contains only one item.

If you override this method, you should implement it so that it will always return the same value each time it is called. If your enumerable contains only one object, this method should always return that object. If your enumerable is empty, this method should return undefined.

1
2
3
4
5
var arr = ["a", "b", "c"];
arr.get('firstObject');  // "a"

var arr = [];
arr.get('firstObject');  // undefined
Module: ember

Becomes true whenever the array currently has observers watching changes on the array.

Module: ember
returns
Object
the last object or undefined

Helper method returns the last object from a collection. If your enumerable contains only one object, this method should always return that object. If your enumerable is empty, this method should return undefined.

1
2
3
4
5
var arr = ["a", "b", "c"];
arr.get('lastObject');  // "c"

var arr = [];
arr.get('lastObject');  // undefined
Module: ember

Your array must support the length property. Your replace methods should set this property whenever it changes.