Options
Menu

Class AsyncSystemBase<QueryUnit, DataUnit, ErrorUnit, Query, Data, Error>

Base class for AsyncSystem.

It can be used to create custom, AsyncSystem like Systems.

See https://docs.activejs.dev/fundamentals/systems/custom-asyncsystem for more details.

Just like every other ActiveJS construct:

  • AsyncSystem extends Base
  • Which further extends Observable

Hierarchy

Constructors

Member Units Properties

Other Properties

Accessors

Access Value Methods

Common Methods

Custom AsyncSystem Methods

Other Methods

Constructors

constructor

Member Units Properties

Readonly dataUnit

dataUnit: DataUnit

The member Unit that is intended to portray the role of response aspect of an async task.

Readonly errorUnit

errorUnit: ErrorUnit

The member Unit that is intended to portray the role of error aspect of an async task.

Readonly pendingUnit

pendingUnit: BoolUnit

The member Unit that is intended to portray the role of pending-status of an async task.

Readonly queryUnit

queryUnit: QueryUnit

The member Unit that is intended to portray the role of query aspect of an async task.

Other Properties

Readonly config

config: Readonly<AsyncSystemBaseConfig<Query, Data, Error>>

Configured options.
Combination of global-options GlobalAsyncSystemConfig and the options passed on instantiation.

Readonly events$

events$: Observable<BaseEvents<AsyncSystemValue<Query, Data, Error>> | any>

On-demand observable events. See https://docs.activejs.dev/guides/events for more details.

Readonly future$

future$: Observable<AsyncSystemValue<Query, Data, Error>> = this.futureSubject.asObservable()

An Observable to observe future values, unlike the default Observable it doesn't replay when subscribed to, rather it waits for the next value.

Accessors

emitCount

  • get emitCount(): number

relationshipsWorking

  • get relationshipsWorking(): boolean

Access Value Methods

value

Common Methods

asObservable

createStream

  • createStream<R>(observableProducer: StreamObservableProducer<QueryUnit, DataUnit, ErrorUnit, R>): Stream
  • A helper method that creates a stream by subscribing to the Observable returned by the param observableProducer callback.

    Ideally the callback function creates an Observable by applying Observable.pipe on the queryUnit or queryUnit.future$ as source Observable.

    Then, after a successful data flow, dispatch the data to the dataUnit;
    and after a failure, dispatch the error to the errorUnit, caught by using RxJS' catchError operator.

    Just know that you should catch the error in a sub-pipe (ie: do not let it propagate to the main-pipe), otherwise as usual the stream will stop working, and will not react on any further emissions.

    Type parameters

    • R

    Parameters

    • observableProducer: StreamObservableProducer<QueryUnit, DataUnit, ErrorUnit, R>

      A callback function that should return an Observable.

    Returns Stream

replay

  • replay(): void

toJsonString

  • toJsonString(): string

Custom AsyncSystem Methods

pauseRelationships

  • pauseRelationships(): void

resumeRelationships

  • resumeRelationships(): void

Other Methods

pipe

  • pipe(): Observable<AsyncSystemValue<Query, Data, Error>>
  • pipe<A>(op1: OperatorFunction<AsyncSystemValue<Query, Data, Error>, A>): Observable<A>
  • pipe<A, B>(op1: OperatorFunction<AsyncSystemValue<Query, Data, Error>, A>, op2: OperatorFunction<A, B>): Observable<B>
  • pipe<A, B, C>(op1: OperatorFunction<AsyncSystemValue<Query, Data, Error>, A>, op2: OperatorFunction<A, B>, op3: OperatorFunction<B, C>): Observable<C>
  • pipe<A, B, C, D>(op1: OperatorFunction<AsyncSystemValue<Query, Data, Error>, A>, op2: OperatorFunction<A, B>, op3: OperatorFunction<B, C>, op4: OperatorFunction<C, D>): Observable<D>
  • pipe<A, B, C, D, E>(op1: OperatorFunction<AsyncSystemValue<Query, Data, Error>, 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<AsyncSystemValue<Query, Data, Error>, 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<AsyncSystemValue<Query, Data, Error>, 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<AsyncSystemValue<Query, Data, Error>, 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<AsyncSystemValue<Query, Data, Error>, 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<AsyncSystemValue<Query, Data, Error>, 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<{}>
  • Returns Observable<AsyncSystemValue<Query, Data, Error>>

  • Type parameters

    • A

    Parameters

    Returns Observable<A>

  • Type parameters

    • A

    • B

    Parameters

    • op1: OperatorFunction<AsyncSystemValue<Query, Data, Error>, A>
    • op2: OperatorFunction<A, B>

    Returns Observable<B>

  • Type parameters

    • A

    • B

    • C

    Parameters

    • op1: OperatorFunction<AsyncSystemValue<Query, Data, Error>, A>
    • op2: OperatorFunction<A, B>
    • op3: OperatorFunction<B, C>

    Returns Observable<C>

  • Type parameters

    • A

    • B

    • C

    • D

    Parameters

    • op1: OperatorFunction<AsyncSystemValue<Query, Data, Error>, 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<AsyncSystemValue<Query, Data, Error>, 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<AsyncSystemValue<Query, Data, Error>, 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<AsyncSystemValue<Query, Data, Error>, 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<AsyncSystemValue<Query, Data, Error>, 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<AsyncSystemValue<Query, Data, Error>, 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<AsyncSystemValue<Query, Data, Error>, 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<{}>

subscribe

  • subscribe(observer?: PartialObserver<AsyncSystemValue<Query, Data, Error>>): Subscription
  • subscribe(next: null | undefined, error: null | undefined, complete: () => void): Subscription
  • subscribe(next: null | undefined, error: (error: any) => void, complete?: () => void): Subscription
  • subscribe(next: (value: AsyncSystemValue<Query, Data, Error>) => void, error: null | undefined, complete: () => void): Subscription
  • subscribe(next?: (value: AsyncSystemValue<Query, Data, Error>) => void, error?: (error: any) => void, complete?: () => void): Subscription
  • Parameters

    Returns Subscription

  • deprecated

    Use an observer instead of a complete callback

    Parameters

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

    Returns Subscription

  • deprecated

    Use an observer instead of an error callback

    Parameters

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

          • error: any

          Returns void

    • Optional complete: () => void
        • (): void
        • Returns void

    Returns Subscription

  • deprecated

    Use an observer instead of a complete callback

    Parameters

    • next: (value: AsyncSystemValue<Query, Data, Error>) => void
    • error: null | undefined
    • complete: () => void
        • (): void
        • Returns void

    Returns Subscription

  • Parameters

    • Optional next: (value: AsyncSystemValue<Query, Data, Error>) => void
    • Optional error: (error: any) => void
        • (error: any): void
        • Parameters

          • error: any

          Returns void

    • Optional complete: () => void
        • (): void
        • Returns void

    Returns Subscription

toPromise

  • toPromise<T>(this: Observable<T>): Promise<T>
  • toPromise<T>(this: Observable<T>, PromiseCtor: typeof Promise): 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: typeof Promise

    Returns Promise<T>

  • Type parameters

    • T

    Parameters

    • this: Observable<T>
    • PromiseCtor: PromiseConstructorLike

    Returns Promise<T>