Skip to content

Function: createSubjectBuffer()

createSubjectBuffer<T>(): CyclicBuffer<T>

Defined in: primitives/buffer.ts:84

Creates a single-value buffer (effectively a buffer with capacity 1). This buffer ensures that a new value can only be written once all currently active readers have consumed the previous value. It provides backpressure by waiting for readers to process the current value before allowing a new one.

Type Parameters

T

T = any

The type of the value in the buffer.

Returns

CyclicBuffer<T>

An object representing the single-value buffer.

Released under the MIT License.