last.js 1.2KB

12345678910111213141516171819202122232425
  1. "use strict";
  2. var last_1 = require('../operators/last');
  3. /* tslint:enable:max-line-length */
  4. /**
  5. * Returns an Observable that emits only the last item emitted by the source Observable.
  6. * It optionally takes a predicate function as a parameter, in which case, rather than emitting
  7. * the last item from the source Observable, the resulting Observable will emit the last item
  8. * from the source Observable that satisfies the predicate.
  9. *
  10. * <img src="./img/last.png" width="100%">
  11. *
  12. * @throws {EmptyError} Delivers an EmptyError to the Observer's `error`
  13. * callback if the Observable completes before any `next` notification was sent.
  14. * @param {function} predicate - The condition any source emitted item has to satisfy.
  15. * @return {Observable} An Observable that emits only the last item satisfying the given condition
  16. * from the source, or an NoSuchElementException if no such items are emitted.
  17. * @throws - Throws if no items that match the predicate are emitted by the source Observable.
  18. * @method last
  19. * @owner Observable
  20. */
  21. function last(predicate, resultSelector, defaultValue) {
  22. return last_1.last(predicate, resultSelector, defaultValue)(this);
  23. }
  24. exports.last = last;
  25. //# sourceMappingURL=last.js.map