A simple priority queue for javascript