A bounded array that automatically maintains a maximum size by removing the oldest entries when new items are added beyond the limit.
Extends the native Array class to provide all standard array methods while enforcing a fixed maximum size of MAX_ARRAY_SIZE (1000 entries).
When the size limit is exceeded, the oldest entries (at the beginning of the array) are automatically removed to make room for new ones.
const commands = new BArray() commands.push(entry) // Automatically removes oldest if over 1000 Copy
const commands = new BArray() commands.push(entry) // Automatically removes oldest if over 1000
Appends new elements to the end of an array, and returns the new length of the array.
New elements to add to the array.
A bounded array that automatically maintains a maximum size by removing the oldest entries when new items are added beyond the limit.
Extends the native Array class to provide all standard array methods while enforcing a fixed maximum size of MAX_ARRAY_SIZE (1000 entries).
When the size limit is exceeded, the oldest entries (at the beginning of the array) are automatically removed to make room for new ones.
Example