SEARCH
0-9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Prev | Current Page 244 | Next

Richard Wagner

"Professional iPhone and iPod touch Programming: Building Applications for Mobile Safari"

For example, minimize their use
inside of loop routines, functions, and arrays. If possible, place before or after to ensure greater efficiency.
// Inefficient
var a=0,c=100;
for (var i=0;i < c;i++) {
// Assign d the value of the next div in the current document
var d = document.getElementByTagName(???div??™)[i];
// Perform some math for a
a=i*1.2;
// Perform some math for b
b=(a+i)/3;
}
// More efficient
// Assign val of d to 100 divs and perform y on them
// based on val of a and b.
var a=0,c=100;
for (var i=0;i < c;i++) {
var d = document.getElementByTagName(???div??™)[i];
a=i*1.2;
b=(a+i)/3;
}
Packaging Apps as
Bookmarks: Bookmarklets
and Data URLs
Because iPhone and iPod touch applications function inside of the Mobile Safari environment,
there are two seemingly obvious restrictions for the Web developer: You must live with the built - in
capabilities of the Mobile Safari browser; and you need a constant Wi - Fi (or, for iPhone, EDGE)
connection in order to run any application.
The truth is that you can get around these limitations by taking advantage of two lesser - known
technologies ??” bookmarklets and data URLs. These technologies have actually been around for
years, but they have tended to exist on the periphery of mainstream Web development.


Pages:
232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256