Options
All
  • Public
  • Public/Protected
  • All
Menu

Package streams

@typed/streams

An official integration with @most/core and Typed :heart:

Index

Type aliases

Component

Component<A, B>: Arity1<A, B>

Type parameters

IOComponent

IOComponent<A, B>: Arity1<A, keyof [B, Disposable]>

Type parameters

Run

Run<A, B>: keyof [A, B, Disposable]

Type parameters

SchedulerEnv

SchedulerEnv: { scheduler: Scheduler }

Type declaration

  • Readonly scheduler: Scheduler

Sinks

Sinks: Readonly<Record<PropertyKey, Stream<any>>>

Sources

Sources: Readonly<Record<PropertyKey, any>>

StreamRef

StreamRef<A>: { clearError: () => void; error: Readonly<Ref<Error>>; value: Readonly<Ref<A>> }

Type parameters

  • A

Type declaration

  • Readonly clearError: () => void
      • (): void
      • Returns void

  • Readonly error: Readonly<Ref<Error>>
  • Readonly value: Readonly<Ref<A>>

StreamState

StreamState<A>: { clearError: () => PureEffect<Maybe<Error>>; error: Maybe<Error>; value: A }

Type parameters

  • A

Type declaration

Functions

createProxySinks

  • createProxySinks<A>(sinks: Record<keyof Sinks, Subject<any, any>>, endSignal: Stream<void>): A

createStreamChannel

disposeSources

  • disposeSources<A>(sources: A): void

filterMaybes

  • filterMaybes<A>(stream: Stream<Maybe<A>>): Stream<A>

replicateSinks

  • replicateSinks<A>(sinks: A, sinkProxies: Record<keyof A, Subject<any, any>>, scheduler: Scheduler): Disposable

run

splitEither

  • splitEither<A, B>(stream: Stream<Either<A, B>>): keyof [Stream<A>, Stream<B>]

useRunStream

  • useRunStream<A>(stream: Stream<A>, sink: Sink<A>): HookEffects<SchedulerEnv & HooksManagerEnv & TimerEnv, Disposable>

useStreamChannel

  • useStreamChannel<A, B>(channel: StreamChannel<unknown, A, B>): ChannelEffects<HookEnv, Stream<B>>

useStreamChannelSink

  • useStreamChannelSink<A, B>(channel: StreamChannel<unknown, A, B>): ChannelEffects<HookEnv, Sink<A>>

useStreamEvents

  • useStreamEvents<A>(stream: Stream<A>, sink: Partial<Sink<A>>): Generator<Env<HookEnv & { scheduler: Scheduler } & HooksManagerEnv & { timer: Timer }, any>, Disposable, any>
  • A convenient helper for listening to the values of a stream

    Type parameters

    • A

    Parameters

    • stream: Stream<A>
    • sink: Partial<Sink<A>>

    Returns Generator<Env<HookEnv & { scheduler: Scheduler } & HooksManagerEnv & { timer: Timer }, any>, Disposable, any>

useStreamRef

useStreamState

  • Mirrors the latest values of a stream and possible errors into A and Maybe respectively backed by useState so your HookEnvironment's will be marked as needing an update as the stream changes. If your component is updating to often, consider using debounce or another time-altering stream combinators.

    Type parameters

    • E

    • A

    Parameters

    Returns HookEffects<E & TimerEnv & HooksManagerEnv & SchedulerEnv, StreamState<A>>

Generated using TypeDoc