CircularBuffer\<T>
Type Parameters
• T
Constructors
new CircularBuffer()
new CircularBuffer<
T
>(capacity
,evictedCallback
?):CircularBuffer
<T
>
Parameters
capacity
number
evictedCallback?
(element
) => void
Returns
Properties
_evictedCallback()
readonly
_evictedCallback: (element
) =>void
Parameters
element
T
Returns
void
Methods
capacity()
capacity():
number
Returns
number
data()
data(): (
undefined
|T
)[]
Returns
(undefined
| T
)[]
isEmpty()
isEmpty():
boolean
Returns
boolean
isFull()
isFull():
boolean
Returns
boolean
pushFront()
pushFront(
element
):boolean
Parameters
element
T
Returns
boolean
resetData()
resetData(
newData
,pushFrontLike
):void
Resets currently stored data with provided array, regarding to current capacity. Note: current capacity will not be changed Note: all previous data will be erased, but the 'evictedCallback()' function will not be called for erased items
Parameters
newData
T
[]
new data to store
pushFrontLike
boolean
= true
if true, the data will be set in the same order as it would be pushed by
Returns
void
Method
pushFront, otherwise, the data will be pushed as it would be done by
Method
pushBack
size()
size():
number
Returns
number
toArray()
toArray():
T
[]
Returns
T
[]