function
stable
Returns an Observable that emits only the last item emitted by the source Observable. It optionally takes a predicate function as a parameter, in which case, rather than emitting the last item from the source Observable, the resulting Observable will emit the last item from the source Observable that satisfies the predicate.
last<T, D>(predicate?: ((value: T, index: number, source: Observable<T>) => boolean) | null, defaultValue?: D): OperatorFunction<T, T | D>
predicate | Optional. Default is The condition any source emitted item has to satisfy. |
defaultValue | Optional. Default is An optional default value to provide if last predicate isn't met or no values were emitted. |
OperatorFunction<T, T | D>
: An Observable that emits only the last item satisfying the given condition from the source, or an NoSuchElementException if no such items are emitted.
EmptyError
Delivers an EmptyError to the Observer's error
callback if the Observable completes before any next
notification was sent.
Error
- Throws if no items that match the predicate are emitted by the source Observable.
last(predicate?: null, defaultValue?: D): OperatorFunction<T, T | D>
predicate | Optional. Default is Type: |
defaultValue | Optional. Default is Type: |
OperatorFunction<T, T | D>
last(predicate: (value: T, index: number, source: Observable<T>) => value is S, defaultValue?: S): OperatorFunction<T, S>
predicate | Type: |
defaultValue | Optional. Default is Type: |
OperatorFunction<T, S>
last(predicate: (value: T, index: number, source: Observable<T>) => boolean, defaultValue?: D): OperatorFunction<T, T | D>
predicate | Type: |
defaultValue | Optional. Default is Type: |
OperatorFunction<T, T | D>
© 2015–2018 Google, Inc., Netflix, Inc., Microsoft Corp. and contributors.
Code licensed under an Apache-2.0 License. Documentation licensed under CC BY 4.0.
https://rxjs.dev/api/operators/last