1. masklinn
  2. jquery.deferred-queue

Commits

masklinn  committed 5ba1f57

deferred queue should be able to accept anything $.when accepts, and react the same way

  • Participants
  • Parent commits 80725e6
  • Branches default

Comments (0)

Files changed (2)

File src/jquery.deferred-queue.js

View file
  • Ignore whitespace
             return $.extend(queueDeferred.promise(), {
                 push: function (promise) {
                     promises += 1;
-                    promise.then(
+                    $.when(promise).then(
                         resolve, $.proxy(queueDeferred, 'reject'));
                     return this;
                 }

File test/test.js

View file
  • Ignore whitespace
             start();
         });
     });
+    asyncTest("Accept non-promises as well", 1, function () {
+        var d = $.Deferred(), v = 3;
+        queue.push(d)
+            .push(3)
+            .then(function () { resolved = true; });
+        d.resolve();
+        setTimeout(function () {
+            ok(resolved);
+            start();
+        });
+    });
 });