Commit d6449937 authored by Romain Courteaud's avatar Romain Courteaud

RSVP.Queue should work without new.

parent 7086f51f
......@@ -18,6 +18,10 @@ var Queue = function() {
fulfill,
reject;
if (!(this instanceof Queue)) {
return new Queue();
}
function canceller() {
for (var i = 0; i < promise_list.length; i++) {
promise_list[i].cancel();
......@@ -65,8 +69,6 @@ var Queue = function() {
return this;
};
return promise;
};
Queue.prototype = Object.create(Promise.prototype);
......
......@@ -1803,6 +1803,16 @@ describe("`RSVP.Queue`", function () {
assert(promise instanceof RSVP.Queue);
assert(promise instanceof RSVP.Promise);
});
it('should work without `new`', function(done) {
var promise = RSVP.Queue()
.push(function() { return 'value'; });
promise.then(function(value) {
assert.equal(value, 'value');
done();
});
});
});
describe("`push`", function () {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment