WIP command-flow / Class

SubjectBasedCommandBus

Decorators:@Injectable
Extends:Subject<Command>
Implements:CommandBus

No documentation has been provided.

Static Properties

NameTypeDescription
create
s
inherited from Subject
(...args: any[]) => any
Deprecated

Recommended you do not use. Will be removed at some point in the future. Plans for replacement still under discussion.

Creates a "subject" by basically gluing an observer to an observable.

Properties

NameTypeDescription
closed
inherited from Subject
boolean
hasError
inherited from Subject
boolean
Deprecated

Internal implementation detail, do not use directly. Will be made internal in v8.

isStopped
inherited from Subject
boolean
Deprecated

Internal implementation detail, do not use directly. Will be made internal in v8.

observers
inherited from Subject
Observer<T>[]
Deprecated

Internal implementation detail, do not use directly. Will be made internal in v8.

operator
inherited from Observable
Operator<any, T> | undefined
Deprecated

Internal implementation detail, do not use directly. Will be made internal in v8.

source
inherited from Observable
Observable<any> | undefined
Deprecated

Internal implementation detail, do not use directly. Will be made internal in v8.

thrownError
inherited from Subject
any
Deprecated

Internal implementation detail, do not use directly. Will be made internal in v8.

Accessors

get observed

inherited from Subject

No documentation has been provided.

Presentation
get observed(): boolean;
Type

boolean

Methods

asObservable()

inherited from Subject

Creates a new Observable with this Subject as the source. You can do this to create custom Observer-side logic of the Subject and conceal it from code that uses the Observable.

Presentation
asObservable(): Observable<T>;
Returns
Overload #1

Creates a new Observable with this Subject as the source. You can do this to create custom Observer-side logic of the Subject and conceal it from code that uses the Observable.

Presentation
asObservable(): Observable<T>;
Returns

complete()

inherited from Subject

No documentation has been provided.

Presentation
complete(): void;
Returns
void
Overload #1

No documentation has been provided.

Presentation
complete(): void;
Returns
void

dispatch()

implements CommandBus

No documentation has been provided.

Presentation
dispatch(command: Command): void;
Parameters
NameTypeDescription
command
Command
Returns
void

error()

inherited from Subject

No documentation has been provided.

Presentation
error(err: any): void;
Parameters
NameTypeDescription
err
any
Returns
void
Overload #1

No documentation has been provided.

Presentation
error(err: any): void;
Parameters
NameTypeDescription
err
any
Returns
void

forEach()

inherited from Observable

Used as a NON-CANCELLABLE means of subscribing to an observable, for use with APIs that expect promises, like async/await. You cannot unsubscribe from this.

WARNING: Only use this with observables you know will complete. If the source observable does not complete, you will end up with a promise that is hung up, and potentially all of the state of an async function hanging out in memory. To avoid this situation, look into adding something like {@link timeout}, {@link take}, {@link takeWhile}, or {@link takeUntil} amongst others.

Example

import { interval, take } from 'rxjs';

const source$ = interval(1000).pipe(take(4));

async function getTotal() {
  let total = 0;

  await source$.forEach(value => {
    total += value;
    console.log('observable -> ' + value);
  });

  return total;
}

getTotal().then(
  total => console.log('Total: ' + total)
);

// Expected:
// 'observable -> 0'
// 'observable -> 1'
// 'observable -> 2'
// 'observable -> 3'
// 'Total: 6'
Presentation
forEach(next: (value: T) => void): Promise<void>;
Parameters
NameTypeDescription
next
(value: T) => void

a handler for each value emitted by the observable

Returns
Promise<void>
Overload #1

Used as a NON-CANCELLABLE means of subscribing to an observable, for use with APIs that expect promises, like async/await. You cannot unsubscribe from this.

WARNING: Only use this with observables you know will complete. If the source observable does not complete, you will end up with a promise that is hung up, and potentially all of the state of an async function hanging out in memory. To avoid this situation, look into adding something like {@link timeout}, {@link take}, {@link takeWhile}, or {@link takeUntil} amongst others.

Example

import { interval, take } from 'rxjs';

const source$ = interval(1000).pipe(take(4));

async function getTotal() {
  let total = 0;

  await source$.forEach(value => {
    total += value;
    console.log('observable -> ' + value);
  });

  return total;
}

getTotal().then(
  total => console.log('Total: ' + total)
);

// Expected:
// 'observable -> 0'
// 'observable -> 1'
// 'observable -> 2'
// 'observable -> 3'
// 'Total: 6'
Presentation
forEach(next: (value: T) => void): Promise<void>;
Parameters
NameTypeDescription
next
(value: T) => void

a handler for each value emitted by the observable

Returns
Promise<void>
Overload #2

No documentation has been provided.

Presentation
forEach(next: (value: T) => void, promiseCtor: PromiseConstructorLike): Promise<void>;
Parameters
NameTypeDescription
next
(value: T) => void

a handler for each value emitted by the observable

promiseCtor
PromiseConstructorLike

a constructor function used to instantiate the Promise

Returns
Promise<void>

lift()

inherited from Subject
Deprecated

Internal implementation detail, do not use directly. Will be made internal in v8.

No documentation has been provided.

Presentation
lift(operator: Operator<T, R>): Observable<R>;
Parameters
NameTypeDescription
operator
Operator<T, R>
Returns
Overload #1

No documentation has been provided.

Presentation
lift(operator: Operator<T, R>): Observable<R>;
Parameters
NameTypeDescription
operator
Operator<T, R>
Returns

next()

inherited from Subject

No documentation has been provided.

Presentation
next(value: T): void;
Parameters
NameTypeDescription
value
T
Returns
void
Overload #1

No documentation has been provided.

Presentation
next(value: T): void;
Parameters
NameTypeDescription
value
T
Returns
void

pipe()

inherited from Observable

No documentation has been provided.

Presentation
Returns
Overload #1

No documentation has been provided.

Presentation
Returns
Overload #2

No documentation has been provided.

Presentation
Parameters
NameTypeDescription
op1
OperatorFunction<T, A>
Returns
Overload #3

No documentation has been provided.

Presentation
pipe(op1: OperatorFunction<T, A>, op2: OperatorFunction<A, B>): Observable<B>;
Parameters
NameTypeDescription
op1
OperatorFunction<T, A>
op2
OperatorFunction<A, B>
Returns
Overload #4

No documentation has been provided.

Presentation
pipe(op1: OperatorFunction<T, A>, op2: OperatorFunction<A, B>, op3: OperatorFunction<B, C>): Observable<C>;
Parameters
NameTypeDescription
op1
OperatorFunction<T, A>
op2
OperatorFunction<A, B>
op3
OperatorFunction<B, C>
Returns
Overload #5

No documentation has been provided.

Presentation
pipe(op1: OperatorFunction<T, A>, op2: OperatorFunction<A, B>, op3: OperatorFunction<B, C>, op4: OperatorFunction<C, D>): Observable<D>;
Parameters
NameTypeDescription
op1
OperatorFunction<T, A>
op2
OperatorFunction<A, B>
op3
OperatorFunction<B, C>
op4
OperatorFunction<C, D>
Returns
Overload #6

No documentation has been provided.

Presentation
pipe(op1: OperatorFunction<T, A>, op2: OperatorFunction<A, B>, op3: OperatorFunction<B, C>, op4: OperatorFunction<C, D>, op5: OperatorFunction<D, E>): Observable<E>;
Parameters
NameTypeDescription
op1
OperatorFunction<T, A>
op2
OperatorFunction<A, B>
op3
OperatorFunction<B, C>
op4
OperatorFunction<C, D>
op5
OperatorFunction<D, E>
Returns
Overload #7

No documentation has been provided.

Presentation
pipe(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>;
Parameters
NameTypeDescription
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
Overload #8

No documentation has been provided.

Presentation
pipe(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>;
Parameters
NameTypeDescription
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
Overload #9

No documentation has been provided.

Presentation
pipe(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>;
Parameters
NameTypeDescription
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
Overload #10

No documentation has been provided.

Presentation
pipe(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>;
Parameters
NameTypeDescription
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
Overload #11

No documentation has been provided.

Presentation
pipe(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<unknown>;
Parameters
NameTypeDescription
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>[]
Returns
Observable<unknown>

subscribe()

inherited from Observable

No documentation has been provided.

Presentation
subscribe(observerOrNext?: Partial<Observer<T>> | ((value: T) => void) | undefined): Subscription;
Parameters
NameTypeDescription
observerOrNext
Partial<Observer<T>> | ((value: T) => void) | undefined
Returns
Overload #1

No documentation has been provided.

Presentation
subscribe(observerOrNext?: Partial<Observer<T>> | ((value: T) => void) | undefined): Subscription;
Parameters
NameTypeDescription
observerOrNext
Partial<Observer<T>> | ((value: T) => void) | undefined
Returns
Overload #2

No documentation has been provided.

Presentation
subscribe(next?: ((value: T) => void) | null | undefined, error?: ((error: any) => void) | null | undefined, complete?: (() => void) | null | undefined): Subscription;
Parameters
NameTypeDescription
next
((value: T) => void) | null | undefined
error
((error: any) => void) | null | undefined
complete
(() => void) | null | undefined
Returns

toPromise()

inherited from Observable
Deprecated

Replaced with {@link firstValueFrom} and {@link lastValueFrom}. Will be removed in v8. Details: https://rxjs.dev/deprecations/to-promise

No documentation has been provided.

Presentation
toPromise(): Promise<T | undefined>;
Returns
Promise<T | undefined>
Overload #1

No documentation has been provided.

Presentation
toPromise(): Promise<T | undefined>;
Returns
Promise<T | undefined>
Overload #2

No documentation has been provided.

Presentation
toPromise(PromiseCtor: PromiseConstructor): Promise<T | undefined>;
Parameters
NameTypeDescription
PromiseCtor
PromiseConstructor
Returns
Promise<T | undefined>
Overload #3

No documentation has been provided.

Presentation
toPromise(PromiseCtor: PromiseConstructorLike): Promise<T | undefined>;
Parameters
NameTypeDescription
PromiseCtor
PromiseConstructorLike
Returns
Promise<T | undefined>

unsubscribe()

inherited from Subject

No documentation has been provided.

Presentation
unsubscribe(): void;
Returns
void
Overload #1

No documentation has been provided.

Presentation
unsubscribe(): void;
Returns
void