Mirror: 🎩 A tiny but capable push & pull stream library for TypeScript and Flow
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Add doc comments to types.ts

+9
+9
src/types.ts
··· 1 + /** A talkback signal is used to tell a [Source] that either the [Sink] is ready for new values or that the stream should be cancelled */ 1 2 export const enum TalkbackKind { 2 3 Pull = 0, 3 4 Close = 1, 4 5 } 5 6 7 + /** A talkback callback is sent to the sink with the [Start] signal to communicate signals back to the source. */ 6 8 export type TalkbackFn = (signal: TalkbackKind) => void; 7 9 export type TeardownFn = () => void; 8 10 ··· 16 18 tag: T; 17 19 } 18 20 21 + /** The start [Signal] is the first signal and carries a callback (talkback) so the sink can send signals to the source */ 19 22 export type Start<_T> = Tag<SignalKind.Start> & [TalkbackFn]; 23 + /** The Push [Signal] carries new values to the sink, like in an event emitter */ 20 24 export type Push<T> = Tag<SignalKind.Push> & [T]; 25 + 26 + /** A signal that communicates new events to a sink. */ 21 27 export type Signal<T> = Start<T> | Push<T> | SignalKind.End; 22 28 29 + /** A sink accepts new values from a [Source], like [Push], [Start], and an end signal. The [Start] is used to receive a callback to send talkback signals back to the source. */ 23 30 export type Sink<T> = (signal: Signal<T>) => void; 31 + /** A source is a function that accepts a [Sink] and then starts sending [Signal]s to it. */ 24 32 export type Source<T> = (sink: Sink<T>) => void; 33 + /** An operator transforms a [Source] and returns a new [Source], potentially with different timings or output types. */ 25 34 export type Operator<In, Out> = (a: Source<In>) => Source<Out>; 26 35 27 36 export interface Subscription {