endWith

Returns an Observable that emits the items you specify as arguments after it finishes emitting items emitted by the source Observable.

endWith<T>(...array: Array<T | SchedulerLike>): MonoTypeOperatorFunction<T>

Parameters

array

Type: Array.

Returns

MonoTypeOperatorFunction<T>: An Observable that emits the items emitted by the source Observable and then emits the items in the specified Iterable.

Description

Example

After the source observable completes, appends an emission and then completes too.

import { of } from 'rxjs'; import { endWith } from 'rxjs/operators'; of('hi', 'how are you?', 'sorry, I have to go now').pipe( endWith('goodbye!'), ) .subscribe(word => console.log(word)); // result: // 'hi' // 'how are you?' // 'sorry, I have to go now' // 'goodbye!'

Overloads

endWith(scheduler?: SchedulerLike): MonoTypeOperatorFunction<T>

Parameters

scheduler

Optional. Default is undefined.

Type: SchedulerLike.

Returns

MonoTypeOperatorFunction<T>

endWith(v1: A, scheduler?: SchedulerLike): OperatorFunction<T, T | A>

Parameters

v1

Type: A.

scheduler

Optional. Default is undefined.

Type: SchedulerLike.

Returns

OperatorFunction<T, T | A>

endWith(v1: A, v2: B, scheduler?: SchedulerLike): OperatorFunction<T, T | A | B>

Parameters

v1

Type: A.

v2

Type: B.

scheduler

Optional. Default is undefined.

Type: SchedulerLike.

Returns

OperatorFunction<T, T | A | B>

endWith(v1: A, v2: B, v3: C, scheduler?: SchedulerLike): OperatorFunction<T, T | A | B | C>

Parameters

v1

Type: A.

v2

Type: B.

v3

Type: C.

scheduler

Optional. Default is undefined.

Type: SchedulerLike.

Returns

OperatorFunction<T, T | A | B | C>

endWith(v1: A, v2: B, v3: C, v4: D, scheduler?: SchedulerLike): OperatorFunction<T, T | A | B | C | D>

Parameters

v1

Type: A.

v2

Type: B.

v3

Type: C.

v4

Type: D.

scheduler

Optional. Default is undefined.

Type: SchedulerLike.

Returns

OperatorFunction<T, T | A | B | C | D>

endWith(v1: A, v2: B, v3: C, v4: D, v5: E, scheduler?: SchedulerLike): OperatorFunction<T, T | A | B | C | D | E>

Parameters

v1

Type: A.

v2

Type: B.

v3

Type: C.

v4

Type: D.

v5

Type: E.

scheduler

Optional. Default is undefined.

Type: SchedulerLike.

Returns

OperatorFunction<T, T | A | B | C | D | E>

endWith(v1: A, v2: B, v3: C, v4: D, v5: E, v6: F, scheduler?: SchedulerLike): OperatorFunction<T, T | A | B | C | D | E | F>

Parameters

v1

Type: A.

v2

Type: B.

v3

Type: C.

v4

Type: D.

v5

Type: E.

v6

Type: F.

scheduler

Optional. Default is undefined.

Type: SchedulerLike.

Returns

OperatorFunction<T, T | A | B | C | D | E | F>

endWith(...array: Array<Z | SchedulerLike>): OperatorFunction<T, T | Z>

Parameters

array

Type: Array.

Returns

OperatorFunction<T, T | Z>