Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does dojo/domReady do?

Tags:

dojo

What is dojo/domReady plugin? which are methods comes under dojo/domReady?

  require(["dojo/_base/fx", "dojo/fx", "dojo/on",
 "dojo/dom", "dojo/domReady!"], function(baseFx, fx, on, dom) {
like image 217
Prashant Vhasure Avatar asked Dec 09 '22 20:12

Prashant Vhasure


2 Answers

  • require() will not continue until the DOM has finished loading
  • it is and plugin and it doesn't provide additional methods
  • http://dojotoolkit.org/reference-guide/1.8/dojo/domReady.html
  • you could be interested also in dojo/ready http://dojotoolkit.org/reference-guide/1.8/dojo/ready.html#dojo-ready
like image 161
k2s Avatar answered Jan 11 '23 01:01

k2s


When you add "dojo/domReady!" to your require() module block, you are instructing Dojo to wait on the callback that you pass until after the DOM has finished loading. So you know that when the DOMContentLoaded event fires, all of the HTML is finished.

There is a subtle different between "dojo/ready" and "dojo/domReady!" in that, "dojo/ready" allows you to pass it a function callback that will only be called after all other require calls have been loaded. This is extremely useful for modules dependant on other modules having being loaded.

Also the "!" in the dojo/domReady just tells you that it is a custom plugin, and isn't a specific plugin.

like image 36
Layke Avatar answered Jan 11 '23 03:01

Layke