Skip to content

Commit

Permalink
Document Channel
Browse files Browse the repository at this point in the history
  • Loading branch information
cowlicks committed Jul 7, 2019
1 parent 5c93004 commit 6517fda
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions selenium/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ async function newDriver() {
}

class Channel {
// async stack datastructure
constructor() {
this.items = [];
this.waiting = [];
Expand All @@ -65,10 +66,13 @@ class Channel {
});
}
}

// Get the item from the top of the stack, or wait for an item if there are none.
async next() {
return await this.popQueue();
}

// Push an item onto the stack.
push(item) {
if (this.waiting.length > 0) {
this.waiting.pop()(item);
Expand Down

0 comments on commit 6517fda

Please sign in to comment.