Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Informer<T>

A small class to use when it is needed to return an asyncronous information. (it's just a wrapper around AsyncSubject)

example:

Let say that the following method have to return an observable (because of the interface of the class). But the value returned by the observable isn't known yet. One can use the Informer to complete the observable asyncronously using the inform method (setTimeOut is used to emulate this asyncronous behaviors).

{
  const i = new Informer<number>()
  setTimeOut(1000,function(){ i.inform(1) })
  return i.obs$
}

Type parameters

  • T

    the object type returned

Hierarchy

  • AsyncSubject<T>
    • Informer

Implements

  • Subscribable<T>
  • SubscriptionLike
  • IHolder<T>

Index

Constructors

constructor

  • Returns Informer

Properties

_isScalar

_isScalar: boolean

Internal implementation detail, do not use directly.

closed

closed: boolean

hasError

hasError: boolean

isStopped

isStopped: boolean

observers

observers: Observer<T>[]

operator

operator: Operator<any, T>
deprecated

This is an internal implementation detail, do not use.

source

source: Observable<any>
deprecated

This is an internal implementation detail, do not use.

thrownError

thrownError: any

Static create

create: Function
nocollapse
deprecated

use new Subject() instead

Static if

if: iif
nocollapse
deprecated

In favor of iif creation function: import { iif } from 'rxjs';

Static throw

throw: throwError
nocollapse
deprecated

In favor of throwError creation function: import { throwError } from 'rxjs';

Accessors

obs$

  • get obs$(): Observable<T>
  • Method to retrieve the observable to wait on for obtaining the value

    Returns Observable<T>

    A cold observable on the value.

Methods

_subscribe

  • _subscribe(subscriber: Subscriber<any>): Subscription
  • deprecated

    This is an internal implementation detail, do not use.

    Parameters

    • subscriber: Subscriber<any>

    Returns Subscription

_trySubscribe

  • _trySubscribe(subscriber: Subscriber<T>): TeardownLogic
  • deprecated

    This is an internal implementation detail, do not use.

    Parameters

    • subscriber: Subscriber<T>

    Returns TeardownLogic

asObservable

  • asObservable(): Observable<T>
  • Creates a new Observable with this Subject as the source. You can do this to create customize Observer-side logic of the Subject and conceal it from code that uses the Observable.

    Returns Observable<T>

    Observable that the Subject casts to

complete

  • complete(): void
  • Returns void

error

  • error(error: any): void
  • Parameters

    • error: any

    Returns void

forEach

  • forEach(next: function, promiseCtor?: PromiseConstructorLike): Promise<void>
  • method

    forEach

    Parameters

    • next: function

      a handler for each value emitted by the observable

        • (value: T): void
        • Parameters

          • value: T

          Returns void

    • Optional promiseCtor: PromiseConstructorLike

    Returns Promise<void>

    a promise that either resolves on observable completion or rejects with the handled error

inform

  • inform(val: T): void
  • Method to call once to set the value when its known. This method will complete the informer object

    Parameters

    • val: T

      Value to set.

    Returns void

lift

  • lift<R>(operator: Operator<T, R>): Observable<R>
  • Type parameters

    • R

    Parameters

    • operator: Operator<T, R>

    Returns Observable<R>

next

  • next(value: T): void
  • Parameters

    • value: T

    Returns void

pipe

  • pipe(): Observable<T>
  • pipe<A>(op1: OperatorFunction<T, A>): Observable<A>
  • pipe<A, B>(op1: OperatorFunction<T, A>, op2: OperatorFunction<A, B>): Observable<B>
  • pipe<A, B, C>(op1: OperatorFunction<T, A>, op2: OperatorFunction<A, B>, op3: OperatorFunction<B, C>): Observable<C>
  • pipe<A, B, C, D>(op1: OperatorFunction<T, A>, op2: OperatorFunction<A, B>, op3: OperatorFunction<B, C>, op4: OperatorFunction<C, D>): Observable<D>
  • pipe<A, B, C, D, E>(op1: OperatorFunction<T, A>, op2: OperatorFunction<A, B>, op3: OperatorFunction<B, C>, op4: OperatorFunction<C, D>, op5: OperatorFunction<D, E>): Observable<E>
  • pipe<A, B, C, D, E, F>(op1: OperatorFunction<T, A>, op2: OperatorFunction<A, B>, op3: OperatorFunction<B, C>, op4: OperatorFunction<C, D>, op5: OperatorFunction<D, E>, op6: OperatorFunction<E, F>): Observable<F>
  • pipe<A, B, C, D, E, F, G>(op1: OperatorFunction<T, A>, op2: OperatorFunction<A, B>, op3: OperatorFunction<B, C>, op4: OperatorFunction<C, D>, op5: OperatorFunction<D, E>, op6: OperatorFunction<E, F>, op7: OperatorFunction<F, G>): Observable<G>
  • pipe<A, B, C, D, E, F, G, H>(op1: OperatorFunction<T, A>, op2: OperatorFunction<A, B>, op3: OperatorFunction<B, C>, op4: OperatorFunction<C, D>, op5: OperatorFunction<D, E>, op6: OperatorFunction<E, F>, op7: OperatorFunction<F, G>, op8: OperatorFunction<G, H>): Observable<H>
  • pipe<A, B, C, D, E, F, G, H, I>(op1: OperatorFunction<T, A>, op2: OperatorFunction<A, B>, op3: OperatorFunction<B, C>, op4: OperatorFunction<C, D>, op5: OperatorFunction<D, E>, op6: OperatorFunction<E, F>, op7: OperatorFunction<F, G>, op8: OperatorFunction<G, H>, op9: OperatorFunction<H, I>): Observable<I>
  • pipe<A, B, C, D, E, F, G, H, I>(op1: OperatorFunction<T, A>, op2: OperatorFunction<A, B>, op3: OperatorFunction<B, C>, op4: OperatorFunction<C, D>, op5: OperatorFunction<D, E>, op6: OperatorFunction<E, F>, op7: OperatorFunction<F, G>, op8: OperatorFunction<G, H>, op9: OperatorFunction<H, I>, ...operations: OperatorFunction<any, any>[]): Observable<__type>
  • Returns Observable<T>

  • Type parameters

    • A

    Parameters

    • op1: OperatorFunction<T, A>

    Returns Observable<A>

  • Type parameters

    • A

    • B

    Parameters

    • op1: OperatorFunction<T, A>
    • op2: OperatorFunction<A, B>

    Returns Observable<B>

  • Type parameters

    • A

    • B

    • C

    Parameters

    • op1: OperatorFunction<T, A>
    • op2: OperatorFunction<A, B>
    • op3: OperatorFunction<B, C>

    Returns Observable<C>

  • Type parameters

    • A

    • B

    • C

    • D

    Parameters

    • op1: OperatorFunction<T, A>
    • op2: OperatorFunction<A, B>
    • op3: OperatorFunction<B, C>
    • op4: OperatorFunction<C, D>

    Returns Observable<D>

  • Type parameters

    • A

    • B

    • C

    • D

    • E

    Parameters

    • op1: OperatorFunction<T, A>
    • op2: OperatorFunction<A, B>
    • op3: OperatorFunction<B, C>
    • op4: OperatorFunction<C, D>
    • op5: OperatorFunction<D, E>

    Returns Observable<E>

  • Type parameters

    • A

    • B

    • C

    • D

    • E

    • F

    Parameters

    • op1: OperatorFunction<T, A>
    • op2: OperatorFunction<A, B>
    • op3: OperatorFunction<B, C>
    • op4: OperatorFunction<C, D>
    • op5: OperatorFunction<D, E>
    • op6: OperatorFunction<E, F>

    Returns Observable<F>

  • Type parameters

    • A

    • B

    • C

    • D

    • E

    • F

    • G

    Parameters

    • op1: OperatorFunction<T, A>
    • op2: OperatorFunction<A, B>
    • op3: OperatorFunction<B, C>
    • op4: OperatorFunction<C, D>
    • op5: OperatorFunction<D, E>
    • op6: OperatorFunction<E, F>
    • op7: OperatorFunction<F, G>

    Returns Observable<G>

  • Type parameters

    • A

    • B

    • C

    • D

    • E

    • F

    • G

    • H

    Parameters

    • op1: OperatorFunction<T, A>
    • op2: OperatorFunction<A, B>
    • op3: OperatorFunction<B, C>
    • op4: OperatorFunction<C, D>
    • op5: OperatorFunction<D, E>
    • op6: OperatorFunction<E, F>
    • op7: OperatorFunction<F, G>
    • op8: OperatorFunction<G, H>

    Returns Observable<H>

  • Type parameters

    • A

    • B

    • C

    • D

    • E

    • F

    • G

    • H

    • I

    Parameters

    • op1: OperatorFunction<T, A>
    • op2: OperatorFunction<A, B>
    • op3: OperatorFunction<B, C>
    • op4: OperatorFunction<C, D>
    • op5: OperatorFunction<D, E>
    • op6: OperatorFunction<E, F>
    • op7: OperatorFunction<F, G>
    • op8: OperatorFunction<G, H>
    • op9: OperatorFunction<H, I>

    Returns Observable<I>

  • Type parameters

    • A

    • B

    • C

    • D

    • E

    • F

    • G

    • H

    • I

    Parameters

    • op1: OperatorFunction<T, A>
    • op2: OperatorFunction<A, B>
    • op3: OperatorFunction<B, C>
    • op4: OperatorFunction<C, D>
    • op5: OperatorFunction<D, E>
    • op6: OperatorFunction<E, F>
    • op7: OperatorFunction<F, G>
    • op8: OperatorFunction<G, H>
    • op9: OperatorFunction<H, I>
    • Rest ...operations: OperatorFunction<any, any>[]

    Returns Observable<__type>

subscribe

  • subscribe(observer?: PartialObserver<T>): Subscription
  • subscribe(next: null | undefined, error: null | undefined, complete: function): Subscription
  • subscribe(next: null | undefined, error: function, complete?: function): Subscription
  • subscribe(next: function, error: null | undefined, complete: function): Subscription
  • subscribe(next?: function, error?: function, complete?: function): Subscription
  • Parameters

    • Optional observer: PartialObserver<T>

    Returns Subscription

  • deprecated

    Use an observer instead of a complete callback

    Parameters

    • next: null | undefined
    • error: null | undefined
    • complete: function
        • (): void
        • Returns void

    Returns Subscription

  • deprecated

    Use an observer instead of an error callback

    Parameters

    • next: null | undefined
    • error: function
        • (error: any): void
        • Parameters

          • error: any

          Returns void

    • Optional complete: function
        • (): void
        • Returns void

    Returns Subscription

  • deprecated

    Use an observer instead of a complete callback

    Parameters

    • next: function
        • (value: T): void
        • Parameters

          • value: T

          Returns void

    • error: null | undefined
    • complete: function
        • (): void
        • Returns void

    Returns Subscription

  • Parameters

    • Optional next: function
        • (value: T): void
        • Parameters

          • value: T

          Returns void

    • Optional error: function
        • (error: any): void
        • Parameters

          • error: any

          Returns void

    • Optional complete: function
        • (): void
        • Returns void

    Returns Subscription

toPromise

  • toPromise<T>(this: Observable<T>): Promise<T>
  • toPromise<T>(this: Observable<T>, PromiseCtor: PromiseConstructor): Promise<T>
  • toPromise<T>(this: Observable<T>, PromiseCtor: PromiseConstructorLike): Promise<T>
  • Type parameters

    • T

    Parameters

    • this: Observable<T>

    Returns Promise<T>

  • Type parameters

    • T

    Parameters

    • this: Observable<T>
    • PromiseCtor: PromiseConstructor

    Returns Promise<T>

  • Type parameters

    • T

    Parameters

    • this: Observable<T>
    • PromiseCtor: PromiseConstructorLike

    Returns Promise<T>

unsubscribe

  • unsubscribe(): void
  • Returns void

Generated using TypeDoc