I have used the Global context and appended variables onto Ti.App to keep simple properties available throughout my app. I understand they are not thread safe, as such I never change them.
In addition to the changes in 1.7.0, I ran across some comments in this question about passing variables that leads me to believe Titanium is going to change something in the future that will cause my applications to break. I would appreciate some clarification from Appcelerator, what changes are coming and how is that going to stop Ti.App extension entirely?
I’m sure other developers are using this and while I understand extending Ti.App has never been recommended per say, without it we are forced to load & reload data on every single window. It’s kind of wasteful and bad for performance. In native iOS development, you can add small things to the AppDelegate and have them available everywhere. I don’t understand why Titanium does not support such a simple concept as global or static classes. Particularly when each window is a new context having a static context available for some common functions would be ideal.
Basically, I want to know if I have to rewrite my entire app, when I will be forced to, and why.
2 Answers
Accepted Answer
you just create your own global context and keep your variables there
Don't pollute the global scope!
here is a blog posting I wrote on it http://blog.clearlyinnovative.com/post/6519148138/titanium-appcelerator-quickie-global-variables-scopes
Aaron, actually, I think instead of hijacking the original question, we are finally trying to answer the original question. This is what Vihn was asking all along, then Mike joined the chorus. Or at least that is how I took the original question.
A complete paradigm shift away from using separate contexts seems to be not only what is being recommended, but close to mandated if it will be the only way we can use proper namespaces now.
All fine and well for new projects. The question all along has been the impact on existing complex projects, and the best way to make the transition.
Your Answer
Think you can help? Login to answer this question!