Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save QGao/2580655 to your computer and use it in GitHub Desktop.
Save QGao/2580655 to your computer and use it in GitHub Desktop.
How to organize a Titanium App.
-------content of app.js--------
Ti.include('somefolder/platform.js');
Ti.include('somefolder/API.js');
Ti.include('somefolder/modules.js');
Ti.include('somefolder/UI.js');
MyApp = {
Platform:{},
API:{},
Modules:{},
UI:{},
};
------------------------------
------content of UI.js--------
MyApp.UI=(function(){
var API = {};
API.foo = function(params){
var foo = require('somefolder/UI/foo.js);
return foo;
};
API.bar = function(params){
var bar = require('somefolder/UI/bar.js);
return bar;
};
return API;
})();
---------------------
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment