Skip to content

Commit

Permalink
Add queue.remove(testFn) (#56)
Browse files Browse the repository at this point in the history
* Add queue.remove(testFn)

Add queue.remove(testFn) to Neo-Async v2.4.0
This function is from Async v2.5.0

* Add queue.remove(testFn)

Add queue.remove(testFn) to Neo-Async v2.4.0
This function is from Async v2.5.0

* test for queue.remove()

test for queue.remove()

* Add queue.remove()

Add queue.remove()

* Add queue.remove()

Add queue.remove()
  • Loading branch information
yles9056 authored and suguru03 committed Oct 3, 2017
1 parent 29c32f8 commit c5e7d6f
Show file tree
Hide file tree
Showing 5 changed files with 231 additions and 152 deletions.
17 changes: 17 additions & 0 deletions dist/async.js
Original file line number Diff line number Diff line change
Expand Up @@ -7783,6 +7783,18 @@
}
return tasks;
};

DLL.prototype.remove = function(testFn) {
var curr = this.head;
while(!!curr) {
var next = curr.next;
if (testFn(curr)) {
this._removeLink(curr);
}
curr = next;
}
return this;
};

/**
* @private
Expand Down Expand Up @@ -7813,6 +7825,7 @@
push: push,
kill: kill,
unshift: unshift,
remove: remove,
process: isQueue ? runQueue : runCargo,
length: getLength,
running: running,
Expand Down Expand Up @@ -7988,6 +8001,10 @@
var count = q.concurrency < q._tasks.length ? q.concurrency : q._tasks.length;
timesSync(count, _resume);
}

function remove(testFn) {
q._tasks.remove(testFn);
}
}

/**
Expand Down
Loading

0 comments on commit c5e7d6f

Please sign in to comment.