This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Sample declarative layout app (Procedural example) | |
* @version 0.1 | |
* @author Rick Blalock | |
* | |
* App Example: | |
* This app uses some concepts from possible 2.0 implementations of require() along with | |
* using declarative layouts. | |
*/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var timetest = new Date(); | |
// TEST ONE WITH PROTOTYPE | |
// function User() {} | |
// for(var i = 0; i < 50000; i++) { | |
// User.prototype[i] = {}; | |
// } | |
// TEST TWO Module Pattern |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var timetest = new Date(); | |
// TEST ONE WITH PROTOTYPE | |
// function User() {} | |
// | |
// for(var i = 0; i < 5000000; i++) { | |
// User.prototype[i] = {}; | |
// } | |
// TEST TWO Module Pattern |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* List UI controller | |
* @class List | |
*/ | |
TFA.Controllers.List = new Class({ | |
Extends: Controller, | |
setOptions: { | |
layout : 'List', // List layout | |
model : 'Tasks', // Tasks model |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*************** | |
Interface | |
***************/ | |
var sync = new DataSync({ | |
dataLocation: 'data.json', | |
imageLocation: 'cachedImages', | |
url: 'http://somewebsite.com/articles.php', | |
imageProperty: 'image' | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Assumed global app namespace | |
var App = { | |
// Example, namespaced objects | |
Controllers: {}, | |
Models: {}, | |
Views: {} | |
}; | |
App.loadObject = function(type, name, params) { | |
if(App[type] == null) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var someNameSpace = {}; | |
(function() { | |
someNameSpace.win = Ti.UI.createWindow(); | |
someNameSpace.title = Ti.UI.createLabel(); | |
someNameSpace.table = Ti.UI.createTableView(); | |
someNameSpace.reset = function() { | |
someNameSpace.win = null; | |
}; | |
})(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var someFunction = function() { | |
var table = Ti.UI.createTableView(), | |
label = Ti.UI.createLabel(); | |
view = Ti.UI.createView(); | |
Ti.App.addEventListener('bad:move', function(e) { | |
table.setData(e.data); | |
}); | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
recursiveInclude = function(folder) { | |
var path = TiFramework.APPDIR + '/' + folder, | |
file = Ti.Filesystem.getFile( Ti.Filesystem.resourcesDirectory + '/' + path ), | |
listing = file.getDirectoryListing(); | |
for (var i = 0; i < listing.length; i++) { | |
// For things like components, nested folder | |
if(listing[i].indexOf('.') == -1) { | |
Ti.include(path + '/' + listing[i] + '/' + listing[i] + '.js'); | |
} else if(listing[i].split('.').pop() === 'js') { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Will release child objects | |
*/ | |
var mypage = function() { | |
var win = Ti.UI.createWindow(), | |
table = Ti.UI.createTableView(), | |
label = Ti.UI.createLabel(); | |
win.add(table); | |
win.add(label); |