PDA

View Full Version : Structuring the app



chachonen
4 May 2011, 10:12 AM
Hi, I'm new to Sencha and would like to ask what is "best practice" for handling application state. For example: in my app there are users who can log in and they may have or not a subscription and users with a valid subscription may do certain actions such as create a post or comment ... Users without a subscription may buy one. Annonymous users may register and list posts.

So my question is: would you create an app controller and let it handle the permission stuff, and from there call the actions on the other controllers? Would you create a sort of delegate and set it on the controllers and the delegate would then check the permissions? How are others handling this?

Thanks for any pointers
Henrik

Jack9
4 May 2011, 4:42 PM
I use a global javascript object for managing cross-cutting concerns.
I simply declare an environment object in my namespace, then set constants, flags, etc. in it.



window.Company = {};
window.Company.Project = {
User : {
premier:false
}
,Env : {
development: false
}
,Constants : {
...
}
};