- More efficient for repeating timers to use setInterval that repeating a setTimer. You'll get better efficiency and scheduling and less overhead.
- Cancel your timers. Calling setInterval which will return a timer handle. to cancel a timer clearTimeout or clearInterval and pass the handle returned by either setTimeout or setInterval.
- Use JSON.parse instead of eval.
- Don't re-use XHR Objects. It's not safe and they're not meant to be re-usable.
This file contains 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
// this sets the background color of the master UIView (when there are no windows/tab groups on it) | |
Titanium.UI.setBackgroundColor('#000'); | |
var win = Ti.UI.createWindow({ | |
title: "Window Title", | |
exitOnClose: true | |
}); | |
win.open(); | |
// CREATE MAP VIEW |
This file contains 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
// this sets the background color of the master UIView (when there are no windows/tab groups on it) | |
Titanium.UI.setBackgroundColor('#000'); | |
Ti.Geolocation.purpose = "FUN"; | |
var win = Ti.UI.createWindow({ | |
exitOnClose: true, | |
backgroundColor:'#336699', | |
title: 'Main Window', | |
navBarHidden: false | |
}); |
This file contains 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
// | |
// in this demo, we simply show how you could dynamically scroll | |
// with a continuous amount of data in the tableview by detecting | |
// when the user's scroll position gets near the end of the table | |
// and start a background fetch of new data and seamlessly append | |
// the new data to the table automatically | |
// | |
var win = Ti.UI.createWindow(); |
This file contains 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
// Include framework files | |
Ti.include('system/core.js'); | |
// Set app preferences | |
var App = new TiGantry( | |
'0.1', // App version | |
'Zergling', // App version name | |
'tweetrdone', // Name of app | |
'app', // Location of app directory | |
'controllers', // Location of controllers directory |
This file contains 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
/** | |
* We're going to create an infinite scrollable list. In this case, we're going to show a date. When you swipe left, | |
* you'll see yesterday. Then the day before yesterday, and so on. Swiping right shows you tomorrow, and so on. | |
*/ | |
var win = Ti.UI.createWindow({ backgroundColor: '#fff' }); | |
var isAndroid = Ti.Platform.osname === 'android'; | |
/** | |
* Track where we are in the infinite scrollable views, and define how large of a step goes between each view. | |
*/ | |
var currentDate = new Date(), msIntervalBetweenViews = 1000/*ms*/ * 60/*s*/ * 60/*m*/ * 24/*h*/; |
This file contains 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
#!/bin/sh | |
# | |
# Copyright (c) 2010 Warren Merrifield | |
# | |
# Permission is hereby granted, free of charge, to any person obtaining a copy | |
# of this software and associated documentation files (the "Software"), to deal | |
# in the Software without restriction, including without limitation the rights | |
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
# copies of the Software, and to permit persons to whom the Software is | |
# furnished to do so, subject to the following conditions: |
This file contains 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
// inspired on http://www.joelpeterson.com/clock/ | |
// and most of the code taken from there as well | |
var win = Ti.UI.createWindow({ | |
orientationModes: [3, 4] | |
}); | |
var clock_bg = Ti.UI.createView({ | |
backgroundColor: '#444444', | |
top: 20, | |
left: 20, |
This file contains 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
friday | |
friday | |
friday |
This file contains 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
forTheDemo |
OlderNewer