I'm back!

After a lot of research I found that the issue I was having with
loading the JavaScript libraries in order had nothing to do with my
code, aside from the fact that it is dynamically loading the jQTouch
library. The issue here talks about the problem:

http://code.google.com/p/jqtouch/issues/detail?id=91

I ended up modifying jQTouch slightly according to this comment:

http://code.google.com/p/jqtouch/issues/detail?id=91#c7

That's not an ideal solution, but it'll do until a better one comes
along. After fixing that issue, everything else just worked. I can now
store large JavaScript libraries in a local browser database and
retrieve them on demand instead of requesting them from the server
every time.

The updated code is here:

http://pastebin.com/f32b790db

The code is well-commented; in practice you would want to reduce code
size as much as possible to ensure faster load times. The only
improvement I want to make is to have the evaluateScript function use
something like setInterval to wait for dependencies to be met instead
of the busy-wait loop in place now.

Thanks, Greg, for your localStorage suggestion. The catch for me was
that there was no hint as to how to get the missing script into the
database without doing an XHR, bringing me back to the load order
problem. Now that I have the database technique down I might see if I
can come up with a localStorage solution as well.

Please take a look at the code and let me know what you all think. I
welcome any criticism. I hope it's of some use to someone. It
certainly is to me! :)

Dan

-- 
You received this message because you are subscribed to the Google Groups 
"iPhoneWebDev" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/iphonewebdev?hl=en.

Reply via email to