Reputation: 31
Is there a way to find whether dojo has completed parsing when dojo.parse.parser(dom-id)
was invoked to parse the document?
I don't want to rely on dojo.addOnLoad()
as I am invoking parser on my own.
Upvotes: 3
Views: 1809
Reputation: 20431
It's done a bit differently in Dojo 1.8:
... Dojo 1.8 can cause the parser to run in an asynchronous fashion ...
require(["dojo/parser", "dojo/_base/array"], function(parser, array){
parser.parse().then(function(instances){
array.forEach(instances, function(instance){
// do something with instances
});
});
});
http://dojotoolkit.org/reference-guide/1.8/dojo/parser.html
Upvotes: 3
Reputation: 7852
I believe that invoking dojo.parser.parse
is a synchronous call, meaning that the next line will only execute once that function has finished parsing widgets. Is there any particular reason to believe that code after dojo.parser.parse(node)
is executing before the widgets in the dom are created?
Using the parseOnLoad: true
property is another story though, which I don't believe is applicable in your case.
Upvotes: 1