Dojo Dijit and HTML5 in Real world applications/Dojo/dojo.Deferred: Difference between revisions
Jump to navigation
Jump to search
(Created page with "__NOTOC__ More to come.. =={{SUBPAGENAME}}== Dojo.Deferred is used to define custom made callback functions. The example below define a deferred function that is called after...") |
No edit summary |
||
Line 24: | Line 24: | ||
</script> | </script> | ||
</syntaxhighlight> | |||
The code above may be tested here: [http://pmis.biz/rwa/dojo.Deferred.php Real world examples..] | The code above may be tested here: [http://pmis.biz/rwa/dojo.Deferred.php Real world examples..] | ||
===Verified in=== | ===Verified in=== |
Latest revision as of 17:30, 13 April 2012
More to come..
dojo.Deferred
Dojo.Deferred is used to define custom made callback functions.
The example below define a deferred function that is called after timer time-out of 2 seconds.
<script type="text/javascript">
function createDeferred(){
console.log("Deferred button clicked");
// Create a deferred and set it to fire in 2 second.
var myDeferred = new dojo.Deferred();
setTimeout(function(){ myDeferred.resolve({called: true});}, 2000);
dojo.byId("response").innerHTML = "Created a deferred.";
// Add a callback that changes the displayed message after it fires.
myDeferred.then(function(){
dojo.byId("response").innerHTML = "Deferred has fired.";
});
}
</script>
The code above may be tested here: Real world examples..
Verified in
IE 8, Firefox 3.6.22, Dojo 1.6.1, Dojo 1.7.2
References
- The code above may be tested here: Real world examples..
Document History
Version | Date | Author | Status | Purpose of update |
---|---|---|---|---|
1 | 13 Apr 2012 | PSA | Draft | Not released. |