WIP command-flow / Class

CommandEventBus

No documentation has been provided.

Static Properties

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

Use new Observable() instead. Will be removed in v8.

Creates a new Observable by calling the Observable constructor

Properties

NameTypeDescription
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.

Methods

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 Observable
Deprecated

Internal implementation detail, do not use directly. Will be made internal in v8. If you have implemented an operator using lift, it is recommended that you create an operator by simply returning new Observable() directly. See "Creating new operators from scratch" section here: https://rxjs.dev/guide/operators

Creates a new Observable, with this Observable instance as the source, and the passed operator defined as the new observable's operator.

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

the operator defining the operation to take on the observable

Returns
Overload #1

Creates a new Observable, with this Observable instance as the source, and the passed operator defined as the new observable's operator.

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

the operator defining the operation to take on the observable

Returns

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>
abstract

publish()

No documentation has been provided.

Presentation
abstract publish(event: CommandEvent<Command>): void;
Parameters
NameTypeDescription
event
CommandEvent<Command>
Returns
void
Overload #1

No documentation has been provided.

Presentation
abstract publish(event: CommandEvent<Command>): void;
Parameters
NameTypeDescription
event
CommandEvent<Command>
Returns
void

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>