Add a function to execute on DOM content loaded and all requested modules have arrived and been evaluated. In most cases, the domReady
plug-in should suffice and this method should not be needed.
When called in a non-browser environment, just checks that all requested modules have arrived and been evaluated.
(priority,context,callback);
Parameter | Type | Description |
---|---|---|
priority | Integer | Optional
The order in which to exec this callback relative to other callbacks, defaults to 1000 |
context | undefined |
The context in which to run execute callback, or a callback if not using context |
callback | Function | Optional
The function to execute. |
See the dojo/ready reference documentation for more information.
Simple DOM and Modules ready syntax
require(["dojo/ready"], function(ready){
ready(function(){ alert("Dom ready!"); });
});
Using a priority
require(["dojo/ready"], function(ready){
ready(2, function(){ alert("low priority ready!"); })
});
Using context
require(["dojo/ready"], function(ready){
ready(foo, function(){
// in here, this == foo
});
});
Using dojo/hitch style args:
require(["dojo/ready"], function(ready){
var foo = { dojoReady: function(){ console.warn(this, "dojo dom and modules ready."); } };
ready(foo, "dojoReady");
});
© 2005–2017 JS Foundation
Licensed under the AFL 2.1 and BSD 3-Clause licenses.
http://dojotoolkit.org/api/1.10/dojo/ready.html