lundi 22 décembre 2014

Where to put complex function in ember-cli application?

I'm getting oriented to the structure of an ember.js application, and I think I understand the purpose of the routes, controllers, models, templates and helpers.


The thing that I don't understand is where I would put a complex function. Suppose I have an action called computeSuggestions, that lives in a controller. It may happen that this one action is very big and complicated, and would be easier to test if it were in its own module, where it could be defined as a pure function.


What would be the typical way to handle this? I'm not very experienced with JavaScript import statements, but I know enough to know that they aren't as easy as in Java or Python. I'm also unsure where in the directory structure would be the normal place for such a function.





Aucun commentaire:

Enregistrer un commentaire