/**
- * Default buffer size
+ * Default buffer size.
*/
export const defaultBufferSize = 2048
/**
* Circular buffer
+ *
+ * @typeParam T - Type of buffer data.
+ * @internal
*/
export class CircularBuffer<T> {
private readonly readIdx: number
private readonly maxArrayIdx: number
/**
- * @param size - Buffer size
- * @returns CircularBuffer
+ * @param size - Buffer size. @defaultValue defaultBufferSize
+ * @returns CircularBuffer.
*/
constructor (size: number = defaultBufferSize) {
this.checkSize(size)
}
/**
- * Puts data into buffer
+ * Puts data into buffer.
*
- * @param data - Data to put into buffer
+ * @param data - Data to put into buffer.
*/
public put (data: T): void {
this.items[this.writeIdx] = data
}
/**
- * Returns buffer as array
+ * Returns buffer as array.
*
- * @returns T[]
+ * @returns Array of buffer data.
*/
public toArray (): T[] {
return this.items.filter(item => item != null) as T[]
* Chooses a worker node for the next task.
*
* @param name - The task function name.
- * @returns The chosen worker node key
+ * @returns The chosen worker node key.
*/
private chooseWorkerNode (name?: string): number {
if (this.shallCreateDynamicWorker()) {