Queue

new Cesium.Queue()

A queue that can enqueue items at the end, and dequeue items from the front.

成员(属性)

readonly length : number

The length of the queue.

方法

Remove all items from the queue.
Check whether this queue contains the specified item.
参数名称 类型 描述信息
item * The item to search for.
Dequeues an item. Returns undefined if the queue is empty.
返回值:
The the dequeued item.
Enqueues the specified item.
参数名称 类型 描述信息
item * The item to enqueue.
Returns the item at the front of the queue. Returns undefined if the queue is empty.
返回值:
The item at the front of the queue.

sort(compareFunction)

Sort the items in the queue in-place.
参数名称 类型 描述信息
compareFunction Queue.Comparator A function that defines the sort order.

定义的类型

Cesium.Queue.Comparator(a, b)number

A function used to compare two items while sorting a queue.
参数名称 类型 描述信息
a * An item in the array.
b * An item in the array.
返回值:
Returns a negative value if a is less than b, a positive value if a is greater than b, or 0 if a is equal to b.
使用示例:
function compareNumbers(a, b) {
    return a - b;
}