PUBLIC
Extends: Ember.Object
Uses: Ember.MutableArray
Defined in: packages/ember-runtime/lib/system/array_proxy.js:35
Module: ember-runtime
An ArrayProxy wraps any other object that implements Ember.Array and/or Ember.MutableArray, forwarding all requests. This makes it very useful for a number of binding use cases or other cases where being able to swap out the underlying array is useful.
A simple example of usage:
let pets = ['dog', 'cat', 'fish'];
let ap = Ember.ArrayProxy.create({ content: Ember.A(pets) });
ap.get('firstObject'); // 'dog'
ap.set('content', ['amoeba', 'paramecium']);
ap.get('firstObject'); // 'amoeba'
This class can also be useful as a layer to transform the contents of an array, as they are accessed. This can be done by overriding objectAtContent:
let pets = ['dog', 'cat', 'fish'];
let ap = Ember.ArrayProxy.create({
content: Ember.A(pets),
objectAtContent: function(idx) {
return this.get('content').objectAt(idx).toUpperCase();
}
});
ap.get('firstObject'); // . 'DOG'
Invoked when the content property changes. Notifies observers that the entire array content has changed.
Invoked when the content property is about to change. Notifies observers that the entire array content will change.
Override to implement content array didChange observer.
Ember.Array
Number
Number
Number
Override to implement content array willChange observer.
Ember.Array
Number
Number
Number
Objectpublic
Should actually retrieve the object at the specified index from the content. You can override this method in subclasses to transform the content item to something new.
This method will only be called if content is non-null.
Number
Object Voidprivate
Should actually replace the specified objects on the content array. You can override this method in subclasses to transform the content item into something new.
This method will only be called if content is non-null.
Number
Number
Array
Void The array that the proxy pretends to be. In the default ArrayProxy implementation, this and content are the same. Subclasses of ArrayProxy can override this property to provide things like sorting and filtering.
Ember.Arrayprivate
The content array. Must be an object that implements Ember.Array and/or Ember.MutableArray.
© 2017 Yehuda Katz, Tom Dale and Ember.js contributors
Licensed under the MIT License.
http://emberjs.com/api/classes/Ember.ArrayProxy.html