An asynchronous implementation of queue using promises