Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's the purpose of ArrayController and ArrayProxy?

Tags:

ember.js

I've been digging into EmberJS for one day :).

I've followed several examples. Some examples used ArrayProxy while others used ArrayController. I looked at the unminified source code and..guess what...Ember.ArrayController is simply extending Ember.ArrayProxy, but there's no extra methods or features in ArrayController.

So..my question is..why do we have two same classes?

like image 379
Moon Avatar asked Jan 30 '12 22:01

Moon


2 Answers

From Ember's API Docs:

Note: As of this writing, ArrayController does not add any functionality to its superclass, ArrayProxy. The Ember team plans to add additional controller-specific functionality in the future, e.g. single or multiple selection support. If you are creating something that is conceptually a controller, use this class.

like image 102
sabithpocker Avatar answered Oct 06 '22 11:10

sabithpocker


There is no difference between the two classes.

It's for all of us who are coming from SproutCore 0.9.x, 1.x and early SproutCore 2 betas and were just use to the name ArrayController I think. I'd recommend using ArrayProxy in case the core team decides to depreciate the one line of code that makes ArrayController possible :-)

like image 38
Roy Daniels Avatar answered Oct 06 '22 12:10

Roy Daniels