Created
February 9, 2013 05:06
-
-
Save aramk/4743917 to your computer and use it in GitHub Desktop.
Uses the following in an example: https://gist.github.com/aramkocharyan/4743836
https://gist.github.com/aramkocharyan/4743839
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require([ | |
"dojo/Deferred" | |
// Add DeferredQueue and DeferredWrapper imports here | |
], function (Deferred, DeferredQueue, DeferredWrapper) { | |
var testDeferred = function () { | |
// Create a wrapper around a callback that returns a deferred object | |
return new DeferredWrapper(function () { | |
// Create a dummy deferred object to finish in 2 seconds | |
var df = new Deferred(); | |
setTimeout(function () { | |
df.resolve(); | |
}, 2000); | |
}); | |
} | |
var queue = new DeferredQueue([ | |
// These will execute one after the other for 6 seconds | |
testDeferred(), | |
testDeferred(), | |
testDeferred() | |
]); | |
queue.start(); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment