Hi all,
I've run into a situation where I may be trying hard to do something
that can be accomplished very easily but for my ignorance.
There has been discussion on this list about iPhone cache sizes and
the wisdom of using certain frameworks which exceed the cache limit.
My thought was to store these extra-large JavaScript libraries in a
local SQLite database, retrieving and evaluating them into the global
scope on page load. If a library isn't in the database I would request
it with XHR, store it in the db, then evaluate it into the global
scope.
First, is this AT ALL useful? Does it actually circumvent the cache
size limit? I know about offline storage and cache manifests, etc. But
my first attempts at implementing this were wonky at best. The
browsers got into a state where they were JUST requesting (and
receiving) the manifest file and would refuse to reload the page.
Second, I am having a hell of a time getting libraries to be evaluated
in the correct order. I believe it has something to do with callbacks
and their asynchronous nature. With that assumption, and in an attempt
to force a load order, I've come up with a (far too) elaborate scheme
that lists dependencies and refuses to load a library until its
dependencies are met. Despite this, it STILL seems that the libraries
are loading out of order, as evidenced by eror messages claiming that,
for instance, "Result of expression '$(_3c.selector).tap' [undefined]
is not a function", or "TypeError: Result of expression
'$.jQTouch' [undefined] is not a constructor", suggesting that jQuery
was not available to jQTouch.
I've pasted my code into pastebin:
http://pastebin.com/f3f365434
Keep in mind that this is preliminary code so there are bound to be
some inefficiencies/questionable bits, etc. It's been a long time
since I did any real JavaScript so I'm not up on the latest best
practices.
Can anyone explain to me why the libraries might be loading in the
wrong order? And also, perhaps, why it has to be this complex?
Thanks,
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.