malaikuangren

What is the purpose or drive to build thing like (xxx),How can it achieve the original goal of design?
understand dojo/domReady!
require(["dojo/dom", "dojo/domReady!"], function(dom){
  dom.byId("helloworld").innerHTML = "Hello New World!";
});

  

The sharped eyed among you will notice that there is a "module" in the requirement array that doesn't have a return variable, called dojo/domReady!. This is actually a loader "plugin" that is used to control the behaviour of the loader. This one ensures that the loader waits until the DOM structure for the page is ready. In an async world, it isn't a bright idea to assume that your DOM structure is there if you want to manipulate it, so if you are going to be doing something with the DOM in your code, make sure you include this plugin. Since we don't use the plugin in the code, it is the standard convention to put it at the end of the array and not provide a return variable for it.

posted on 2014-06-04 16:45  malaikuangren  阅读(210)  评论(0编辑  收藏  举报