code: function _queueTimeout(timeout) {
      // insert the new timeout at the right place in the array, sorted by time
      if (timeouts.length > 0) {
        var i = timeouts.length - 1;
        while (i >= 0 && timeouts[i].time > timeout.time) {
          i--;
        }
  
        // insert the new timeout in the queue. Note that the timeout is
        // inserted *after* existing timeouts with the exact *same* time,
        // so the order in which they are executed is deterministic
        timeouts.splice(i + 1, 0, timeout);
      }
      else {
        // queue is empty, append the new timeout
        timeouts.push(timeout);
      }
    }
docs: Add a timeout to the queue. After the queue has been changed, the queue
  must be rescheduled by executing _reschedule()
  @param {{id: number, type: number, time: number, callback: Function}} timeout
  @private