When _flushQueuedTasks is called we queue up the function that will flush the data. That way when the callback to beforeFlush is called, the flush data will be flushed in the order that _flushQueuedTasks was called. This fixes a bug that was seen: _flushQueuedTasks is called for the first time, and the pipeline frame is listening to the "beforeFlush" event. The pipeline frame asynchronously renders the frame. But before it finishes _flushQueuedTasks is called again and its callback to "beforeFlush" is called before the first callback to "beforeFlush", resulting in an out of order flush. This fix ensures that the second callback to "beforeFlush" doesn't do anything, and when the first callback to "beforeFlush" finishes, it would flush twice in the proper order.