Skip to content

Instantly share code, notes, and snippets.

@aramk
Created February 9, 2013 05:06
Show Gist options
  • Save aramk/4743917 to your computer and use it in GitHub Desktop.
Save aramk/4743917 to your computer and use it in GitHub Desktop.
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