Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

programmatic example

  • Loading branch information...
commit 7d424fc2252fa506317b4a587dcbc50ffe7eab30 1 parent 06b950c
@wkeese wkeese authored
Showing with 23 additions and 3 deletions.
  1. +23 −3 dijit/ProgressBar.rst
View
26 dijit/ProgressBar.rst
@@ -12,6 +12,26 @@ This method works best for long-running JavaScript operations, or a series of Ja
Examples
========
+Programmatic
+------------
+
+.. code-example ::
+
+ .. js ::
+
+ require(["dijit/ProgressBar", "dojo/_base/window", "dojo/ready"], function(ProgressBar, win, ready){
+ ready(function(){
+ var i = 0;
+ var myProgressBar = new ProgressBar({
+ style: "width: 300px"
+ }).placeAt(win.body());
+ setInterval(function(){
+ myProgressBar.set("value", i++ % 100);
+ }, 100);
+ });
+ });
+
+
Declarative markup
------------------
@@ -21,10 +41,10 @@ Declarative markup
require(["dojo/parser", "dijit/ProgressBar"], function(){
var i = 0;
- this.download = function(){
- myProgressBar.update({maximum: 10, progress: ++i});
+ download = function(){
+ myProgressBar.set({value: ++i});
if(i < 10){
- setTimeout(download, 10 + Math.floor(Math.random() * 100));
+ setTimeout(download, 100 + Math.floor(Math.random() * 1000));
}
}
});
Please sign in to comment.
Something went wrong with that request. Please try again.