Skip to content
This repository has been archived by the owner on Oct 18, 2023. It is now read-only.

Commit

Permalink
Rename evented queue "waitFor" method "waitBehind" to maintain queue …
Browse files Browse the repository at this point in the history
…metaphor

 🐿 v2.10.0
  • Loading branch information
i-like-robots committed Feb 13, 2019
1 parent 3fccd98 commit 05dcd01
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/evented-queue.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class EventedQueue extends EventEmitter {
return this;
}

waitFor(items = []) {
waitBehind(items = []) {
return new Promise((resolve) => {
const callback = () => {
const itemsWaiting = items.some((item) => this.waiting.has(item));
Expand Down
2 changes: 1 addition & 1 deletion src/run-parallel.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ module.exports = (tasks = [], concurrency = 1, preserveOrder = false) => {

// wait for any dependencies still in the queue to finish
if (preserveOrder) {
await queue.waitFor(pkg.allDependencies);
await queue.waitBehind(pkg.allDependencies);
}

await apply();
Expand Down
4 changes: 2 additions & 2 deletions test/src/evented-queue.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,14 @@ describe('src/evented-queue', () => {
});
});

describe('#waitFor', () => {
describe('#waitBehind', () => {
it('resolves when the queue no longer contains any of the given items', (done) => {
instance
.add('foo')
.add('bar')
.add('baz');

instance.waitFor(['foo', 'bar', 'baz']).then(() => {
instance.waitBehind(['foo', 'bar', 'baz']).then(() => {
expect(instance.waiting.size).toEqual(0);
done();
});
Expand Down

0 comments on commit 05dcd01

Please sign in to comment.