Skip to content

Commit

Permalink
Merged in ksd-243 (pull request #49)
Browse files Browse the repository at this point in the history
KSD-243 remove arguments shifting from queue
  • Loading branch information
dmfay committed Sep 5, 2014
2 parents 494f6cd + ea49d6c commit b5075ab
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 22 deletions.
8 changes: 5 additions & 3 deletions lib/run.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ function collectResultsFromFrames(context, options, callback) {
var node = frame.node,
win = node.contentWindow;

q.defer(function (_, done) {
q.defer(function (done) {

var timeout = setTimeout(function () {
done({});
Expand Down Expand Up @@ -124,7 +124,7 @@ function collectResultsFromFrames(context, options, callback) {
}
});
});
}, node);
});
}

for (var i = 0, l = frames.length; i < l; i++) {
Expand All @@ -150,7 +150,9 @@ dqre.run = function run(context, options, callback) {
var q = utils.queue();

if (context.frames.length) {
q.defer(collectResultsFromFrames, context, options);
q.defer(function (done) {
collectResultsFromFrames(context, options, done);
});
}
q.defer(function (cb) {
dqre.audit.run(context, options, cb);
Expand Down
6 changes: 2 additions & 4 deletions lib/utils/queue.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
(function () {
'use strict';

var slice = [].slice;
function noop() {}

/**
Expand Down Expand Up @@ -45,8 +43,8 @@
* First parameter should be the function to execute with subsequent
* parameters being passed as arguments to that function
*/
defer: function () {
tasks.push(slice.call(arguments));
defer: function (fn) {
tasks.push([fn]);
++remaining;
pop();
},
Expand Down
15 changes: 0 additions & 15 deletions test/unit/utils/queue.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,21 +53,6 @@ describe('utils.queue', function () {

});

it('should allow parameters to be passed', function (done) {
var q = utils.queue(),
expected = { monkeys: 'bananas' };

q.defer(function (data, callback) {
assert.deepEqual(data, expected);
callback(data);
}, expected);

q.then(function (data) {
assert.deepEqual(data, [expected]);
done();
});
});

});

describe('then', function () {
Expand Down

0 comments on commit b5075ab

Please sign in to comment.