Skip to content

Instantly share code, notes, and snippets.

@mtrudel
Created June 26, 2011 21:45
Show Gist options
  • Save mtrudel/1048001 to your computer and use it in GitHub Desktop.
Save mtrudel/1048001 to your computer and use it in GitHub Desktop.
// windows/*.js look like:
definePage( 'main', {
load: function() {},
unload: function() {},
show: function() {},
hide: function() {}
})
//////// Ti Query side:
var $.definePage = function( name, page ) {
$.pages[ name ] = page
}
windowsDir.each {
Ti.include(page)
}
// Now $.pages is filled out
var openWindow = function( newName ) {
var oldName = $.currentPage
var oldPage = $.states[ oldName ]
if (! $.states[ newName ] ) $.states[ newName ] = {}
var newPage = $.states[ newName ]
if (devMode) {
$.pages[ newName ] = // get from HTTP
// Walk through the state transitions, passing in oldPage / newPage as the value of this
// If oldWindow marks itself as persistable, and we have room in states[], save it out
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment