On Fri, 10 Jun 2011 22:30:42 +0000 (UTC), Ian Hickson wrote:
On Thu, 31 Mar 2011, Diogo Resende wrote:
I would like your opinion on this use case:
I have an app divided in several modules, each one has a javascript
code
that needs to run to show the module page and init the interactions.
The
app is not supposed to reload to show each module.
What is the best way to fetch the javascript code and run it? Add a
<script> for that module and remove it when switching to another
module?
Download using AJAX or other technology and use eval()?
I'm not sure I understand the use case exactly.
If you just mean that you have several different "panels" or "modes"
that
the user can switch between, then I would recommend just having
several
<section> elements, one for each module, and all but the active one
have a
hidden="" attribute. Script-wise, you'd just have each script loaded
and
active from the start, they'd just only work with their own sections.
The sections are not possible to enumerate or can be too many to
enumerate. Imagine MobileMe, where each section of the web app has it's
own interaction (java)script (I suppose). I'm looking for the best way
to load that when switching between sections/modules and discarding it
when switch back.
Perhaps MobileMe could have the interaction all bundled in one script,
but for a bigger app to have a fast load/response time, the scripts
should be divided.. I think..
--
Diogo