Interface StatefulSubjectController<Actions>

A ControllableStream is ReadableStream that can have chunks queued to from an external source.

Example

Queuing items externally.

const controller = new ControllableStream<number>()
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)
interface StatefulSubjectController<Actions> {
    #source: ControllableSource<AccumulateStateReducerInput<Actions, ListOf<keyof Actions>, {
        action: "__INIT__";
        param: void;
    }>>;
    locked: boolean;
    get desiredSize(): null | number;
    cancel(reason?): Promise<void>;
    close(): void;
    dispatch<Action>(action, param?): void;
    enqueue(chunk): void;
    error(error?): void;
    getReader(options): ReadableStreamBYOBReader;
    getReader(): ReadableStreamDefaultReader<AccumulateStateReducerInput<Actions, ListOf<keyof Actions>, {
        action: "__INIT__";
        param: void;
    }>>;
    getReader(options?): ReadableStreamReader<AccumulateStateReducerInput<Actions, ListOf<keyof Actions>, {
        action: "__INIT__";
        param: void;
    }>>;
    onPull(pullListener): (() => void);
    pipeThrough<T>(transform, options?): ReadableStream<T>;
    pipeTo(destination, options?): Promise<void>;
    tee(): [ReadableStream<AccumulateStateReducerInput<Actions, ListOf<keyof Actions>, {
        action: "__INIT__";
        param: void;
    }>>, ReadableStream<AccumulateStateReducerInput<Actions, ListOf<keyof Actions>, {
        action: "__INIT__";
        param: void;
    }>>];
}

Type Parameters

  • Actions extends Record<string, unknown>

Hierarchy (view full)

Properties

#source: ControllableSource<AccumulateStateReducerInput<Actions, ListOf<keyof Actions>, {
    action: "__INIT__";
    param: void;
}>>
locked: boolean

Accessors

Methods

  • Parameters

    • Optional reason: any

    Returns Promise<void>

  • Parameters

    • options: {
          mode: "byob";
      }
      • mode: "byob"

    Returns ReadableStreamBYOBReader

  • Returns ReadableStreamDefaultReader<AccumulateStateReducerInput<Actions, ListOf<keyof Actions>, {
        action: "__INIT__";
        param: void;
    }>>

  • Parameters

    • Optional options: ReadableStreamGetReaderOptions

    Returns ReadableStreamReader<AccumulateStateReducerInput<Actions, ListOf<keyof Actions>, {
        action: "__INIT__";
        param: void;
    }>>

  • Type Parameters

    • T

    Parameters

    • transform: ReadableWritablePair<T, AccumulateStateReducerInput<Actions, ListOf<keyof Actions>, {
          action: "__INIT__";
          param: void;
      }>>
    • Optional options: StreamPipeOptions

    Returns ReadableStream<T>

  • Parameters

    • destination: WritableStream<AccumulateStateReducerInput<Actions, ListOf<keyof Actions>, {
          action: "__INIT__";
          param: void;
      }>>
    • Optional options: StreamPipeOptions

    Returns Promise<void>

  • Returns [ReadableStream<AccumulateStateReducerInput<Actions, ListOf<keyof Actions>, {
        action: "__INIT__";
        param: void;
    }>>, ReadableStream<AccumulateStateReducerInput<Actions, ListOf<keyof Actions>, {
        action: "__INIT__";
        param: void;
    }>>]

Generated using TypeDoc