Tuesday, February 5, 2013

If the parser auto-requires modules, it will always behave in a promise fashion



From the API documentation for Dojo/Parser:

If the parser auto-requires modules, it will always behave in a promise fashion and parser.parse().then(function(instances){...}) should be used.

This means that if the module included in a data-dojo-type hasn’t previously been required, then the parser will call require itself and attempt to load the file.  When it does this, then the parse runs asynchronously.   If the module needs to act on the parsed content, then the promise needs to be used.

No comments:

Post a Comment