push a items into the stack, and immediately resolve any lingering promises, otherwise the new items will just get stacked up in the internal items array.
make a request to pop the top item in the stack. if no stacked item is currently available, you will receive a promise that will resolve if an item is pushed, after all other promises that came after you have been served.
dump off all currently available stacked items, and receive them as a returned value.
the last item in the returned array is at the top of the stack, while the first item in the array is the bottom of the stack.
drop off the resolvers of all currently unresolved promises in the stack. this means that all existing promises will remain hanging, unless you resolve them yourself with the returned resolver functions.
the last item in the returned array is at the top of the stack, meaning that it should be served/resolved first, while the first item in the array is the last resolver that should be served (bottom of the stack).
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 stack list that can be asynchronously awaited to receive new items.
Example