Created
June 17, 2011 15:48
-
-
Save phiggins42/1031681 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// untested poc/theory code | |
define(["dojo/parser"], function(parser){ | |
var asyncParser = function(rootNode, oldSupport){ | |
// summary: An asyncronous | |
var dfd = new dojo.Deferred(), | |
deps = dojo.query("[dojoType], [data-dojo-type]", rootNode).filter(function(n){ | |
return (n.getAttribute("data-dojo-type") || n.getAttribute("dojoType")).replace(/\./g, "/"); | |
}) | |
; | |
deps.push("dojo/ready!"); | |
require(deps, function(){ | |
dfd.callback(parser.parse(rootNode)) | |
}); | |
return dfd; | |
} | |
return asyncParser; | |
}); | |
// usage: | |
define(["dojo/asyncparser"], function(parse){ | |
dojo.when(parse(), function(){ | |
alert("all widgets insantiated"); | |
}) | |
}) |
it looks like a reasonable poc for how i'd imagine it might work.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
ahh makes sense. I'm just in the habit of
{{{
dojo.require("a.b.c");
dojo.ready(theyAReDone)
}}}
and that translated into my deps pushing
... either way, I've not actually run/tested this snipplette of code, it was the result of thread on dojo-contrib and me seeing how it might work out.
not sure how to handle the "we don't use globals" vs "well where do you put it" question just yet.