Skip to content

Instantly share code, notes, and snippets.

@phiggins42
Created June 17, 2011 15:48
Show Gist options
  • Save phiggins42/1031681 to your computer and use it in GitHub Desktop.
Save phiggins42/1031681 to your computer and use it in GitHub Desktop.
// 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");
})
})
@neonstalwart
Copy link

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