On Oct 21, 5:43 pm, Wes Garland <
w...@page.ca> wrote:
I'm actually doing something like that at the mo - although still
under development and only firefox at the mo, so the info from KrisZ
is very valuable.
I'm matching with onLoad event for modules that are loaded via the
system, and matching with script-tag-src for modules that are loaded
via script-tag.
I found 2 problems with the latter:
1) when the module-file gets renamed (f.i. because there are multiple
version of the same compilation).
2) when there are multiple script-tags in the page, some loading
modules and others for other stuff.
In such a case, I'm using some extra attribute, call it 'main' or
'platform' or whatever, to filter the ones that load modules and that
correspond to a particular version - idea stolen from requireJS
documentation, I must add.
One of the other things I needed to re-introduce is 'require.pause'
and 'require.resume' - to be able to load multiple modules in one file
from script-tag.
Loading multiple modules in one file via the module-system can again
use onLoad events - essentially doing an implicit pause-resume.
Although I must say I didn't do too much testing on this yet so not
sure if there are any race-conditions breaking this strategy.
I'm using no top-level IDs at all in my definitions - they are all
matched to onLoad-event or script-tag-src, and when using multiple
modules, I have one main module without ID and the others relative to
this one. This allows to load multiple different versions of the
system that are using modules that are common to both versions. Only
thing that doesn't work with this strategy are foreign modules - i.e.
modules that are not relative to the module-file that is being loaded,
these are the only ones that do need top-level IDs, and so didn't find
a secure way yet to load these from script-tag - was planning to only
allow load via modules-system.
Stefaan