Class ControllableSource<T>

The underlying source of a ReadableStream that can have chunks queued to from an external source.

Example

Queuing items externally.

const controller = new ControllableSource<number>()
const stream = new ReadableStream(controller)
controller.enqueue(1)
controller.enqueue(2)
controller.enqueue(3)
controller.close()

Registering pull subscribers externally.

const controller = new ControllableStream<number>()
let i = -1
controller.onPull(() => ++i)

Type Parameters

  • T

Implements

Constructors

Properties

#controller: ReadableStreamDefaultController<T>
#pullListeners: ControllerPullListener<T>[] = []

Accessors

Methods

Generated using TypeDoc