push items into the queue, and immediately resolve any queued up promises, otherwise just queue up the new items in the internal array.
make a request to pop the first item in the queue. if no queued item is currently available, you will receive a promise that will resolve as soon as an item is pushed, and after all other promises that came before you have been served.
dump off all currently available queued items, and receive them as a returned value.
the first item in the returned array is the first item in the queue (highest priority/first to be served), while the last item in the array is at the end of the queue (least priority/last to be served).
drop off the resolvers of all currently unresolved promises in the queue. this means that all existing promises will remain hanging, unless you resolve them yourself with the returned resolver functions.
the first item in the returned array is the first resolver function in the queue (highest priority/first to be served), while the last item in the array is the last resolver that should be served in the queue (least priority).
returns the number of immediately available items, or the number of queued up requests.
n, it indicates that |n| number of items are queued up,
and you can immediately shift |n| number of times.n, it indicates that |n| number of promises are waiting to be resolved,
and that if you shift right now, you will be receiving a promise to the |n| + 1 item in the future (relative to now).
create a queue list that can be asynchronously awaited to receive new items.
TODO: should I also make the
itemsnon-private, so that they're accessible from super classes?Example