Event queue

ROT.EventQueue is a very simple tool to maintain a sorted priority list. It offers basic API for adding, removing and retrieving stuff. For most scenarios, the Event queue is too low-level and you might want to use a specific scheduler instead.

Time units in Event queue are abstract and do not need to be integers. The getTime() method can be used to retrieve the amount of already elapsed time units.

var queue = new ROT.EventQueue(); queue.add("event 1", 100); /* queued after 100 time units */ queue.add("event 2", 10); /* queued after 10 time units */ queue.add("event 3", 50); /* queued after 50 time units */ queue.remove("event 2"); SHOW( queue.get(), queue.get(), queue.getTime() );