Options
All
  • Public
  • Public/Protected
  • All
Menu

Package subscription

@typed/subscription

Generic data-type for one-to-many broadcasting of data.

Index

Type aliases

CombineSubscriptions

CombineSubscriptions<A>: Subscription<SubscriptionValues<A>>

Type parameters

Subscriber

Subscriber<A>: Arity1<A, Disposable>

Type parameters

  • A

SubscriptionInput

SubscriptionInput<A>: A extends Subscription<infer R, any> ? R : never

Type parameters

  • A

SubscriptionOutput

SubscriptionOutput<A>: A extends Subscription<any, infer R> ? R : never

Type parameters

  • A

SubscriptionValues

SubscriptionValues<A>: {}

Type parameters

Type declaration

Variables

Const debounce

debounce: { <A, B>(timer: Timer, delayMs: number, subscription: Subscription<A, B>): Subscription<A, B>; (timer: Timer, delayMs: number): <A, B>(subscription: Subscription<A, B>) => Subscription<A, B>; (timer: Timer): { <A, B>(delayMs: number, subscription: Subscription<A, B>): Subscription<A, B>; (delayMs: number): <A, B>(subscription: Subscription<A, B>) => Subscription<A, B> } } = curry(__debounce) as {<A, B>(timer: Timer, delayMs: number, subscription: Subscription<A, B>): Subscription<A, B>(timer: Timer, delayMs: number): <A, B>(subscription: Subscription<A, B>) => Subscription<A, B>(timer: Timer): {<A, B>(delayMs: number, subscription: Subscription<A, B>): Subscription<A, B>(delayMs: number): <A, B>(subscription: Subscription<A, B>) => Subscription<A, B>}}

Type declaration

Const delay

delay: { <A, B>(timer: Timer, delayMs: number, subscription: Subscription<A, B>): Subscription<A, B>; (timer: Timer, delayMs: number): <A, B>(subscription: Subscription<A, B>) => Subscription<A, B>; (timer: Timer): { <A, B>(delayMs: number, subscription: Subscription<A, B>): Subscription<A, B>; (delayMs: number): <A, B>(subscription: Subscription<A, B>) => Subscription<A, B> } } = curry(__delay) as {<A, B>(timer: Timer, delayMs: number, subscription: Subscription<A, B>): Subscription<A, B>(timer: Timer, delayMs: number): <A, B>(subscription: Subscription<A, B>) => Subscription<A, B>(timer: Timer): {<A, B>(delayMs: number, subscription: Subscription<A, B>): Subscription<A, B>(delayMs: number): <A, B>(subscription: Subscription<A, B>) => Subscription<A, B>}}

Type declaration

Const filter

filter: { <A>(predicate: Is<A>, subscription: Subscription<any, any>): Subscription<SubscriptionInput<typeof subscription>, A>; <A>(predicate: Predicate<A>, subscription: Subscription<any, A>): Subscription<SubscriptionInput<typeof subscription>, A>; <A>(predicate: Is<A>): (subscription: Subscription<any, any>) => Subscription<SubscriptionInput<typeof subscription>, A>; <A>(predicate: Predicate<A>): (subscription: Subscription<any, A>) => Subscription<SubscriptionInput<typeof subscription>, A> } = curry(__filter)

Type declaration

Const map

map: { <A, B, C>(fn: Arity1<B, C>, subscription: Subscription<A, B>): Subscription<A, C>; <B, C>(fn: Arity1<B, C>): <A>(subscription: Subscription<A, B>) => Subscription<A, C> } = curry(<A, B, C>(fn: Arity1<B, C>, subscription: Subscription<A, B>): Subscription<A, C> => {const subscribe = (subscriber: Subscriber<C>): Disposable =>subscription.subscribe(pipe(fn, subscriber))return {...subscription,subscribe,}},) as {<A, B, C>(fn: Arity1<B, C>, subscription: Subscription<A, B>): Subscription<A, C><B, C>(fn: Arity1<B, C>): <A>(subscription: Subscription<A, B>) => Subscription<A, C>}

Map over a subscription

param

:: (b -> c)

param

:: Subscription a b

returns

Subscription a c

Type declaration

Const scan

scan: { <A, B, C>(reducer: (acc: C, value: B) => C, seed: C, subscription: Subscription<A, B>): Subscription<A, C>; <B, C>(reducer: (acc: C, value: B) => C, seed: C): <A>(subscription: Subscription<A, B>) => Subscription<A, C>; <B, C>(reducer: (acc: C, value: B) => C): { <A>(seed: C, subscription: Subscription<A, B>): Subscription<A, C>; (seed: C): <A>(subscription: Subscription<A, B>) => Subscription<A, C> } } = curry(__scan) as {<A, B, C>(reducer: (acc: C, value: B) => C,seed: C,subscription: Subscription<A, B>,): Subscription<A, C><B, C>(reducer: (acc: C, value: B) => C, seed: C): <A>(subscription: Subscription<A, B>,) => Subscription<A, C><B, C>(reducer: (acc: C, value: B) => C): {<A>(seed: C, subscription: Subscription<A, B>): Subscription<A, C>(seed: C): <A>(subscription: Subscription<A, B>) => Subscription<A, C>}}

Type declaration

Functions

combine

createSubscription

merge

Const once

  • once<A>(__namedParameters: { subscribe: (f: (value: A) => void) => Disposable }): Promise<A>
  • Subscribe to a subscription just once.

    Type parameters

    • A

    Parameters

    • __namedParameters: { subscribe: (f: (value: A) => void) => Disposable }
      • subscribe: (f: (value: A) => void) => Disposable
          • (f: (value: A) => void): Disposable
          • Parameters

            • f: (value: A) => void
                • (value: A): void
                • Parameters

                  • value: A

                  Returns void

            Returns Disposable

    Returns Promise<A>

Generated using TypeDoc