Creates a waiter function which takes orders and serves orders in a way and calls a ready function when all orders have been served.

This function is valid in v2.0.0 to v2.14.2. This function has been downloaded 2 times.


{Function} fnReady
Function to be called when the waiter function is has been called to serve the last remaining order. When called this function will receive all of the orders ever made as the 1st argument and the final order as the 2nd.
{boolean=} opt_clearOrdersAfterReady Optional, Default:false
If true-ish the orders array will be cleared after the fnReady function is called. This prevents previous orders from showing up if fnReady is called multiple times.


A waiter function which take and serve orders. The 1st argument passed to this function should be a boolean indicating that an order is going in. The 2nd argument passed to this function can be any value that represents an order. When this function is called a boolean will be returned indicating whether or not the call was successful. The only way false can be returned by this function is if an order is to be served that doesn't exist.

Required Functions

This function requires the following functions which are included automatically:

  • slice()
    Slice does not modify the original array, but instead returns a shallow copy of elements from the original array.
  • is()
    Tests to see if two or more values are exactly the same. This is similar to === but will also indicate that NaN is NaN and will indicate that -0 is not 0.