[Dojo-interest] Help: Packaging & Layers
Peter E Higgins
dante at dojotoolkit.org
Tue Dec 18 16:17:31 UTC 2007
> In any event, now I'm searching for how to call the dojo parser so I can
> remove parseOnLoad. I need to do that before I can load the second layer
> separately.
dojo.require("dojo.parser"); // done for you if parseOnLoad:true
dojo.parser.parse(); // parse the body, and init widgets
// parse a node as top level, and init widgets within:
var node = dojo.byId("container");
dojo.parser.parse(node);
it looks for a dojoType attribute, and creates an instance of the class passed
to that attribute.
in the dijit/themes/themeTester.html there is an example of how to simulate
some kind of pre-loader, though it only defers the parsing, not
dojo.require()'ing ... the details on dynamically injecting layers are fuzzy
though.
for instance, you (iirc) cant:
dojo.addOnLoad(function(){
dojo["require"]("dijit.form.Button");
new dijit.form.Button({});
});
in ie6, or not at least the last time i tried.
why not have two pages? the first loading and caching the dojo.js from your
server, the second (after login) including both the dojo.js and custom.js
layers. the effect is ultimately the same, minus a page refresh and
infinitely more simple to maintain. it may not be practical in your use
case, but is something to consider. That way, your landing page will preload
styles and whatnot, so when you goto the widget-enabled pages, it's all
cached (with proper server config...) ...
just a thought.
Regards,
Peter Higgins
More information about the Dojo-interest
mailing list