Skip to content

Instantly share code, notes, and snippets.

@krawaller
Created February 16, 2011 16:02
Show Gist options
  • Save krawaller/829615 to your computer and use it in GitHub Desktop.
Save krawaller/829615 to your computer and use it in GitHub Desktop.
Ti.include("/struct/struct.js");
S.app.mainWindow = S.ui.createApplicationWindow();
S.app.mainWindow.open();
S.app.mood = "RADIANT!";
Ti.App.fireEvent("app:mood.update");
setTimeout(function(){Ti.App.fireEvent("app:msg",{msg:"Welcome!"});},1000);
var S = {
os: function(arg){
// utility function for branching logic depending on os
},
app: { // application state variables
mood: "radiant"
},
ui: {
styles: {
// various app-wide theme definitions
},
createApplicationWindow: function(){
// creates the main app window. Called from app.js, will in turn call the
// other view constructors and populate the window. Defined in
// applicationwindow.js
},
createFooView: function(){
// creates the red empty Foo view. Defined in fooview.js, used in
// createApplicationWindow.
},
createBarView: function(){
// creates the green Bar view containing mood info. Defined in
// barview.js, used in createApplicationWindow.
},
createBazView: function(){
// creates the blue Baz view where you can set mood. Defined
// in bazview.js, used in createApplicationWindow.
}
}
};
myButton.addEventListener("click",function(){
Ti.UI.currentTab.open(Ti.UI.createWindow({url:'somefile.js', importantdata: mydata }));
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment